Skip to content

Commit

Permalink
Merge pull request #128 from xylar/fix-raising-step-baseline-error
Browse files Browse the repository at this point in the history
Raise error only at task level on baseline failure
  • Loading branch information
xylar authored Oct 4, 2023
2 parents a702eeb + 5a26ac5 commit 0c57352
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions polaris/run/serial.py
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ def _log_and_run_task(task, stdout_logger, task_logger, quiet,
task_list = ', '.join(task.steps_to_run)
task_logger.info(f'Running steps: {task_list}')
try:
_run_task(task, available_resources)
baselines_passed = _run_task(task, available_resources)
run_status = success_str
task_pass = True
except Exception:
Expand All @@ -335,8 +335,16 @@ def _log_and_run_task(task, stdout_logger, task_logger, quiet,
status = f' task execution: {run_status}'
if task_pass:
stdout_logger.info(status)
result_str = pass_str
success = True
if baselines_passed:
baseline_str = pass_str
result_str = pass_str
success = True
else:
baseline_str = fail_str
result_str = fail_str
success = False
status = f' baseline comp.: {baseline_str}'
stdout_logger.info(status)
else:
stdout_logger.error(status)
if not is_task:
Expand All @@ -359,6 +367,7 @@ def _run_task(task, available_resources):
"""
logger = task.logger
cwd = os.getcwd()
baselines_passed = True
for step_name in task.steps_to_run:
step = task.steps[step_name]
complete_filename = os.path.join(step.work_dir,
Expand Down Expand Up @@ -411,12 +420,14 @@ def _run_task(task, available_resources):
_print_to_stdout(task,
f' baseline comp.: {baseline_str}')
if not status:
raise ValueError('Baseline comparison failed.')
baselines_passed = False

_print_to_stdout(task,
f' runtime: '
f'{start_time_color}{step_time_str}{end_color}')

return baselines_passed


def _run_step(task, step, new_log_file, available_resources,
step_log_filename):
Expand Down

0 comments on commit 0c57352

Please sign in to comment.