Show whether a job still exists

In the dashboard and on the job page, indicate whether the job appears
in the latest jobset eval. That way, the user gets some indication if
a job has accidentally disappeared (e.g. due to an evaluation error).
This commit is contained in:
Eelco Dolstra
2014-04-08 18:49:10 +02:00
parent 4471cae07e
commit be63c50560
3 changed files with 20 additions and 2 deletions

View File

@ -8,7 +8,7 @@ __PACKAGE__->config(
TEMPLATE_EXTENSION => '.tt',
PRE_CHOMP => 1,
POST_CHOMP => 1,
expose_methods => [qw/buildLogExists buildStepLogExists/]);
expose_methods => [qw/buildLogExists buildStepLogExists jobExists/]);
sub buildLogExists {
my ($self, $c, $build) = @_;
@ -22,4 +22,15 @@ sub buildStepLogExists {
return defined findLog($c, $step->drvpath, @outPaths);
}
# Check whether the given job is a member of the most recent jobset
# evaluation.
sub jobExists {
my ($self, $c, $job) = @_;
my $latestEval = $job->jobset->jobsetevals->search(
{ hasnewbuilds => 1},
{ rows => 1, order_by => ["id desc"] })->single;
return 0 if !defined $latestEval; # can't happen
return scalar($latestEval->builds->search({ job => $job->name })) != 0;
}
1;