From 49a46393770b55e617abe0638f0b9289ab96c8bf Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Tue, 8 Mar 2016 19:44:51 +0100 Subject: [PATCH] Add a more concise queue page The old page didn't scale very well if you have 150K builds in the queue, in fact it tended to make browsers hang. The new one just shows, for each jobset, the number of queued builds. The actual builds can be seen by going to the corresponding jobset page and looking at the evals. --- src/lib/Hydra/Controller/Root.pm | 11 +++++++++++ src/root/queue-summary.tt | 33 ++++++++++++++++++++++++++++++++ src/root/topbar.tt | 2 +- 3 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 src/root/queue-summary.tt diff --git a/src/lib/Hydra/Controller/Root.pm b/src/lib/Hydra/Controller/Root.pm index 8827d4f0..5070c090 100644 --- a/src/lib/Hydra/Controller/Root.pm +++ b/src/lib/Hydra/Controller/Root.pm @@ -102,6 +102,17 @@ sub queue_GET { } +sub queue_summary :Local :Path('queue-summary') :Args(0) { + my ($self, $c) = @_; + $c->stash->{template} = 'queue-summary.tt'; + + $c->stash->{queued} = $c->model('DB')->schema->storage->dbh->selectall_arrayref( + "select project, jobset, count(*) as queued, min(timestamp) as oldest, max(timestamp) as newest from Builds " . + "where finished = 0 group by project, jobset order by queued desc", + { Slice => {} }); +} + + sub status :Local :Args(0) :ActionClass('REST') { } sub status_GET { diff --git a/src/root/queue-summary.tt b/src/root/queue-summary.tt new file mode 100644 index 00000000..9932cb8f --- /dev/null +++ b/src/root/queue-summary.tt @@ -0,0 +1,33 @@ +[% WRAPPER layout.tt title="Queue summary" %] +[% PROCESS common.tt %] + +[% IF queued.size == 0 %] + +
There are no pending builds.
+ +[% ELSE %] + + + + + + + + + + + + [% FOREACH j IN queued %] + + + + + + + [% END %] + +
Jobset# QueuedOldest queuedNewest queued
[% INCLUDE renderFullJobsetName project=j.project jobset=j.jobset %][% HTML.escape(j.queued) %][% INCLUDE renderRelativeDate timestamp=j.oldest %][% INCLUDE renderRelativeDate timestamp=j.newest %]
+ +[% END %] + +[% END %] diff --git a/src/root/topbar.tt b/src/root/topbar.tt index 14dba82a..54051fa8 100644 --- a/src/root/topbar.tt +++ b/src/root/topbar.tt @@ -17,7 +17,7 @@ [% WRAPPER makeSubMenu title="Status" %] [% INCLUDE menuItem - uri = c.uri_for(c.controller('Root').action_for('queue')) + uri = c.uri_for(c.controller('Root').action_for('queue_summary')) title = "Queue ("_ nrRunningBuilds _"/"_ nrQueuedBuilds _")" %] [% INCLUDE menuItem uri = c.uri_for(c.controller('Root').action_for('status'))