Skip to content
This repository has been archived by the owner on Sep 18, 2024. It is now read-only.

test log updates #2297

Merged
merged 1 commit into from
Apr 11, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions test/nni_test/nnitest/run_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,14 +117,13 @@ def launch_test(config_file, training_service, test_case_config):

proc = subprocess.run(shlex.split(launch_command))

assert proc.returncode == 0, '`nnictl create` failed with code %d' % proc.returncode
assert proc.returncode == 0, 'launch command failed with code %d' % proc.returncode

# set experiment ID into variable
experiment_id = get_experiment_id(EXPERIMENT_URL)
exp_var_name = test_case_config.get('setExperimentIdtoVar')
if exp_var_name is not None:
assert exp_var_name.startswith('$')
it_variables[exp_var_name] = experiment_id
it_variables[exp_var_name] = get_experiment_id(EXPERIMENT_URL)
print('variables:', it_variables)

max_duration, max_trial_num = get_max_values(config_file)
Expand All @@ -136,8 +135,10 @@ def launch_test(config_file, training_service, test_case_config):
bg_time = time.time()
print(str(datetime.datetime.now()), ' waiting ...', flush=True)
try:
# wait restful server to be ready
time.sleep(3)
experiment_id = get_experiment_id(EXPERIMENT_URL)
while True:
time.sleep(3)
waited_time = time.time() - bg_time
if waited_time > max_duration + 10:
print('waited: {}, max_duration: {}'.format(waited_time, max_duration))
Expand All @@ -150,8 +151,13 @@ def launch_test(config_file, training_service, test_case_config):
if num_failed > 0:
print('failed jobs: ', num_failed)
break
time.sleep(3)
except:
print_experiment_log(experiment_id=experiment_id)
print('nnictl log stderr:')
subprocess.run(shlex.split('nnictl log stderr'))
print('nnictl log stdout:')
subprocess.run(shlex.split('nnictl log stdout'))
raise
print(str(datetime.datetime.now()), ' waiting done', flush=True)
if get_experiment_status(STATUS_URL) == 'ERROR':
Expand Down