Skip to content
Merged
Show file tree
Hide file tree
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
6 changes: 6 additions & 0 deletions paddles/models/runs.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ def __json__(self):
suite=self.suite,
machine_type=self.machine_type,
sha1=results['sha1'],
priority=self.priority,
)

@classmethod
Expand Down Expand Up @@ -210,6 +211,11 @@ def _updated(self):
def href(self):
return "%s/runs/%s/" % (conf.address, self.name),

@property
def priority(self):
if self.jobs.count():
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')
Expand Down
6 changes: 6 additions & 0 deletions paddles/tests/models/test_runs.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,3 +242,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
Loading