Fix build-queued plugin hook

This commit is contained in:
Shea Levy 2017-05-24 10:38:29 -04:00
parent c40077ece1
commit dfb3a52f67

View file

@ -471,8 +471,6 @@ sub checkBuild {
print STDERR "added build ${\$build->id} (${\$jobset->project->name}:${\$jobset->name}:$jobName)\n";
});
system("hydra-notify build-queued " . $build->id)
if defined $build && defined $buildMap->{$build->id} && $buildMap->{$build->id}->{new};
return $build;
};
@ -639,6 +637,7 @@ sub checkJobsetWrapped {
my $jobsetChanged = 0;
my $dbStart = clock_gettime(CLOCK_MONOTONIC);
my %buildMap;
txn_do($db, sub {
my $prevEval = getPrevJobsetEval($db, $jobset, 1);
@ -649,7 +648,6 @@ sub checkJobsetWrapped {
$jobset->builds->search({iscurrent => 1})->update({iscurrent => 0});
# Schedule each successfully evaluated job.
my %buildMap;
foreach my $job (permute(values %{$jobs})) {
next if defined $job->{error};
#print STDERR "considering job " . $project->name, ":", $jobset->name, ":", $job->{jobName} . "\n";
@ -739,6 +737,10 @@ sub checkJobsetWrapped {
Net::Statsd::increment("hydra.evaluator.evals");
Net::Statsd::increment("hydra.evaluator.cached_evals") unless $jobsetChanged;
while (my ($id, $x) = each %buildMap) {
system("hydra-notify build-queued $id") if $x->{new};
}
# Store the error messages for jobs that failed to evaluate.
my $msg = "";
foreach my $job (values %{$jobs}) {