From: Michael Tremer Date: Sun, 8 Oct 2017 16:19:21 +0000 (+0100) Subject: jobs: Show rank in build queue X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ca3e24f84faa6710b13d6e1845f87051acd525bd;p=pbs.git jobs: Show rank in build queue Signed-off-by: Michael Tremer --- diff --git a/src/buildservice/builds.py b/src/buildservice/builds.py index d81240f2..053b05cd 100644 --- a/src/buildservice/builds.py +++ b/src/buildservice/builds.py @@ -1719,6 +1719,19 @@ class Job(base.Object): def size(self): return sum((p.size for p in self.packages)) + @lazy_property + def rank(self): + """ + Returns the rank in the build queue + """ + if not self.state == "pending": + return + + res = self.db.get("SELECT rank FROM jobs_queue WHERE job_id = %s", self.id) + + if res: + return res.rank + def is_running(self): """ Returns True if job is in a running state. diff --git a/src/templates/jobs-detail.html b/src/templates/jobs-detail.html index b75e4337..ad79d818 100644 --- a/src/templates/jobs-detail.html +++ b/src/templates/jobs-detail.html @@ -99,6 +99,12 @@
{% module JobState(job, cls="lead", show_icon=True) %} + {% if job.rank %} +

+ {{ _("#%s in the build queue") % job.rank }} +

+ {% end %} +