From d88411d853fe1bca2d8f8a9bb1d78d82c4a4ee43 Mon Sep 17 00:00:00 2001 From: Zack Cerza Date: Fri, 9 Aug 2024 14:17:09 -0600 Subject: [PATCH] Run: Add 'priority' to returned fields Signed-off-by: Zack Cerza --- paddles/models/runs.py | 5 +++++ paddles/tests/models/test_runs.py | 6 ++++++ 2 files changed, 11 insertions(+) diff --git a/paddles/models/runs.py b/paddles/models/runs.py index 0e2a620..bf00edc 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') 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