From 54b8cb188e0c77421b6617cd80cb4e83a4d992dc Mon Sep 17 00:00:00 2001 From: Graham Christensen Date: Tue, 26 Jan 2021 09:50:59 -0500 Subject: [PATCH] perl: jobsetevals -> jobset via by jobset_id Frankly, this was suspiciously little work. --- src/lib/Hydra/Controller/Admin.pm | 2 +- src/lib/Hydra/Controller/JobsetEval.pm | 2 +- src/lib/Hydra/Helper/Nix.pm | 2 +- src/root/common.tt | 2 +- src/script/hydra-eval-jobset | 5 ++++- 5 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/lib/Hydra/Controller/Admin.pm b/src/lib/Hydra/Controller/Admin.pm index 20ef73fa..e2a219ff 100644 --- a/src/lib/Hydra/Controller/Admin.pm +++ b/src/lib/Hydra/Controller/Admin.pm @@ -34,7 +34,7 @@ sub machines : Chained('admin') PathPart('machines') Args(0) { sub clear_queue_non_current : Chained('admin') PathPart('clear-queue-non-current') Args(0) { my ($self, $c) = @_; my $builds = $c->model('DB::Builds')->search( - { id => { -in => \ "select id from Builds where id in ((select id from Builds where finished = 0) except (select build from JobsetEvalMembers where eval in (select max(id) from JobsetEvals where hasNewBuilds = 1 group by project, jobset)))" } + { id => { -in => \ "select id from Builds where id in ((select id from Builds where finished = 0) except (select build from JobsetEvalMembers where eval in (select max(id) from JobsetEvals where hasNewBuilds = 1 group by jobset_id)))" } }); my $n = cancelBuilds($c->model('DB')->schema, $builds); $c->flash->{successMsg} = "$n builds have been cancelled."; diff --git a/src/lib/Hydra/Controller/JobsetEval.pm b/src/lib/Hydra/Controller/JobsetEval.pm index 41c5471d..cc231833 100644 --- a/src/lib/Hydra/Controller/JobsetEval.pm +++ b/src/lib/Hydra/Controller/JobsetEval.pm @@ -16,8 +16,8 @@ sub evalChain : Chained('/') PathPart('eval') CaptureArgs(1) { or notFound($c, "Evaluation $evalId doesn't exist."); $c->stash->{eval} = $eval; - $c->stash->{project} = $eval->project; $c->stash->{jobset} = $eval->jobset; + $c->stash->{project} = $eval->jobset->project; } diff --git a/src/lib/Hydra/Helper/Nix.pm b/src/lib/Hydra/Helper/Nix.pm index fd7a3170..eb6e7dce 100644 --- a/src/lib/Hydra/Helper/Nix.pm +++ b/src/lib/Hydra/Helper/Nix.pm @@ -219,7 +219,7 @@ sub getEvals { foreach my $curEval (@evals) { my ($prevEval) = $c->model('DB::JobsetEvals')->search( - { project => $curEval->get_column('project'), jobset => $curEval->get_column('jobset') + { jobset_id => $curEval->get_column('jobset_id') , hasnewbuilds => 1, id => { '<', $curEval->id } }, { order_by => "id DESC", rows => 1 }); diff --git a/src/root/common.tt b/src/root/common.tt index 8d4f4f70..bfb5982f 100644 --- a/src/root/common.tt +++ b/src/root/common.tt @@ -463,7 +463,7 @@ BLOCK renderEvals %] [% eval.id %] [% IF !jobset && !build %] - [% INCLUDE renderFullJobsetName project=eval.get_column('project') jobset=eval.get_column('jobset') %] + [% INCLUDE renderFullJobsetName project=eval.jobset.project.name jobset=eval.jobset.name %] [% END %] [% INCLUDE renderRelativeDate timestamp = eval.timestamp %] diff --git a/src/script/hydra-eval-jobset b/src/script/hydra-eval-jobset index dbf03499..f128af88 100755 --- a/src/script/hydra-eval-jobset +++ b/src/script/hydra-eval-jobset @@ -191,8 +191,11 @@ sub fetchInputEval { $eval = getLatestFinishedEval($jobset); die "jobset ‘$value’ does not have a finished evaluation\n" unless defined $eval; } elsif ($value =~ /^($projectNameRE):($jobsetNameRE):($jobNameRE)$/) { + my $jobset = $db->resultset('Jobsets')->find({ project => $1, name => $2 }); + die "jobset ‘$1:$2’ does not exist\n" unless defined $jobset; + $eval = $db->resultset('JobsetEvals')->find( - { project => $1, jobset => $2, hasnewbuilds => 1 }, + { jobset_id => $jobset->id, hasnewbuilds => 1 }, { order_by => "id DESC", rows => 1 , where => \ [ # All builds in this jobset should be finished...