Merge pull request #1111 from DeterminateSystems/project-jobset/queue-summary-machines

Project jobset columns: fixup /queue-summary and /machines
This commit is contained in:
Graham Christensen 2022-01-14 15:34:43 -05:00 committed by GitHub
commit 42a871e413
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 4 deletions

View file

@ -136,8 +136,9 @@ sub queue_summary :Local :Path('queue-summary') :Args(0) {
$c->stash->{template} = 'queue-summary.tt';
$c->stash->{queued} = dbh($c)->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",
"select jobsets.project as project, jobsets.name as jobset, count(*) as queued, min(timestamp) as oldest, max(timestamp) as newest from Builds " .
"join Jobsets jobsets on jobsets.id = builds.jobset_id " .
"where finished = 0 group by jobsets.project, jobsets.name order by queued desc",
{ Slice => {} });
$c->stash->{systems} = dbh($c)->selectall_arrayref(
@ -199,8 +200,10 @@ sub machines :Local Args(0) {
$c->stash->{machines} = $machines;
$c->stash->{steps} = dbh($c)->selectall_arrayref(
"select build, stepnr, s.system as system, s.drvpath as drvpath, machine, s.starttime as starttime, project, jobset, job, s.busy as busy " .
"from BuildSteps s join Builds b on s.build = b.id " .
"select build, stepnr, s.system as system, s.drvpath as drvpath, machine, s.starttime as starttime, jobsets.project, jobsets.name, job, s.busy as busy " .
"from BuildSteps s " .
"join Builds b on s.build = b.id " .
"join Jobsets jobsets on jobsets.id = b.jobset_id " .
"where busy != 0 order by machine, stepnr",
{ Slice => {} });
$c->stash->{template} = 'machine-status.tt';

View file

@ -23,11 +23,21 @@ my $jobset = createBaseJobset("basic", "basic.nix", $ctx{jobsdir});
ok(evalSucceeds($jobset), "Evaluating jobs/basic.nix should exit with return code 0");
subtest "/machines" => sub {
my $response = request(GET '/machines');
ok($response->is_success, "The page showing the machine status 200's.");
};
subtest "/queue-runner-status" => sub {
my $global = request(GET '/queue-runner-status');
ok($global->is_success, "The page showing the queue runner status 200's.");
};
subtest "/queue-summary" => sub {
my $response = request(GET '/queue-summary');
ok($response->is_success, "The page showing the queue summary 200's.");
};
subtest "/queue" => sub {
my $response = request(GET '/queue', Accept => 'application/json');
ok($response->is_success, "The page showing the queue 200's.");