diff --git a/paddles/models/runs.py b/paddles/models/runs.py index 0e2a620..601d398 100644 --- a/paddles/models/runs.py +++ b/paddles/models/runs.py @@ -168,6 +168,7 @@ def __json__(self): suite=self.suite, machine_type=self.machine_type, sha1=results['sha1'], + priority=self.priority, ) @classmethod @@ -211,6 +212,10 @@ def _updated(self): def href(self): return "%s/runs/%s/" % (conf.address, self.name), + @property + def priority(self): + return self.jobs[0].priority + def get_results(self): jobs_status = [value[0] for value in self.jobs.values(Job.status)] queued = jobs_status.count('queued') @@ -270,6 +275,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..6138bd6 100644 --- a/paddles/tests/models/test_runs.py +++ b/paddles/tests/models/test_runs.py @@ -235,3 +235,9 @@ def test_run_results(self): Job(dict(job_id=70+i, id=int(70+i) ,status=status), new_run) stats_out[status] = count assert new_run.get_results() == stats_in + + def test_run_priority(self): + run_name = "run_priority" + new_run = Run(run_name) + Job(dict(job_id=1, id=1, status='queued', priority=99), new_run) + assert new_run.priority == 99