From 298a18fe88b02f18d898dfe874813c7e3220d8ac Mon Sep 17 00:00:00 2001 From: Zack Cerza Date: Fri, 9 Aug 2024 12:09:33 -0600 Subject: [PATCH] Run: Fall back to setting queued status When a run consists of jobs with a mix of 'queued' and 'pass' statuses, they are ending up with a status of 'unknown'. Use 'queued' in that case instead. Signed-off-by: Zack Cerza --- paddles/models/runs.py | 2 ++ paddles/tests/models/test_runs.py | 7 +++++++ 2 files changed, 9 insertions(+) diff --git a/paddles/models/runs.py b/paddles/models/runs.py index 0e2a620..5824fec 100644 --- a/paddles/models/runs.py +++ b/paddles/models/runs.py @@ -270,6 +270,8 @@ def set_status(self, results=None): # all passing => pass elif results['pass'] == total: new_status = 'finished pass' + elif results['queued']: + new_status = 'queued' # this should not happen else: new_status = 'unknown' diff --git a/paddles/tests/models/test_runs.py b/paddles/tests/models/test_runs.py index 3a6380a..50539af 100644 --- a/paddles/tests/models/test_runs.py +++ b/paddles/tests/models/test_runs.py @@ -207,6 +207,13 @@ def test_run_status_all_dead(self): #Job(dict(job_id=16, id=16, status='dead'), new_run) assert new_run.status == 'finished dead' + def test_run_status_one_pass(self): + run_name = "run_status_one_pass" + new_run = Run(run_name) + Job(dict(job_id=15, id=15, status='queued'), new_run) + Job(dict(job_id=50, id=50, status='pass'), new_run) + assert new_run.status == 'queued' + def test_run_user(self): run_name = "teuthology-2013-12-22_01:00:02-x-x-x-x-x" new_run = Run(run_name)