Merge remote-tracking branch 'origin/master' into flake

This commit is contained in:
Eelco Dolstra
2019-08-15 13:56:00 +02:00
22 changed files with 239 additions and 227 deletions

View File

@ -447,7 +447,7 @@ sub checkBuild {
# semantically unnecessary (because they're implied by
# the eval), but they give a factor 1000 speedup on
# the Nixpkgs jobset with PostgreSQL.
{ project => $jobset->project->name, jobset => $jobset->name, job => $jobName,
{ project => $jobset->get_column('project'), jobset => $jobset->name, job => $jobName,
name => $firstOutputName, path => $firstOutputPath },
{ rows => 1, columns => ['id'], join => ['buildoutputs'] });
if (defined $prevBuild) {
@ -498,7 +498,7 @@ sub checkBuild {
$buildMap->{$build->id} = { id => $build->id, jobName => $jobName, new => 1, drvPath => $drvPath };
$$jobOutPathMap{$jobName . "\t" . $firstOutputPath} = $build->id;
print STDERR "added build ${\$build->id} (${\$jobset->project->name}:${\$jobset->name}:$jobName)\n";
print STDERR "added build ${\$build->id} (${\$jobset->get_column('project')}:${\$jobset->name}:$jobName)\n";
});
return $build;
@ -540,7 +540,7 @@ sub sendJobsetErrorNotification() {
return if $jobset->project->owner->emailonerror == 0;
return if $errorMsg eq "";
my $projectName = $jobset->project->name;
my $projectName = $jobset->get_column('project');
my $jobsetName = $jobset->name;
my $body = "Hi,\n"
. "\n"
@ -577,7 +577,7 @@ sub permute {
sub checkJobsetWrapped {
my ($jobset) = @_;
my ($jobset, $tmpId) = @_;
my $project = $jobset->project;
my $jobsetsJobset = length($project->declfile) && $jobset->name eq ".jobsets";
my $inputInfo = {};
@ -626,6 +626,7 @@ sub checkJobsetWrapped {
print STDERR $fetchError;
txn_do($db, sub {
$jobset->update({ lastcheckedtime => time, fetcherrormsg => $fetchError }) if !$dryRun;
$db->storage->dbh->do("notify eval_failed, ?", undef, join('\t', $tmpId));
});
return;
}
@ -641,6 +642,7 @@ sub checkJobsetWrapped {
Net::Statsd::increment("hydra.evaluator.unchanged_checkouts");
txn_do($db, sub {
$jobset->update({ lastcheckedtime => time, fetcherrormsg => undef });
$db->storage->dbh->do("notify eval_cached, ?", undef, join('\t', $tmpId));
});
return;
}
@ -710,6 +712,9 @@ sub checkJobsetWrapped {
, flake => $flakeRef
});
$db->storage->dbh->do("notify eval_added, ?", undef,
join('\t', $tmpId, $ev->id));
if ($jobsetChanged) {
# Create JobsetEvalMembers mappings.
while (my ($id, $x) = each %buildMap) {
@ -787,10 +792,6 @@ 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}) {
@ -808,8 +809,15 @@ sub checkJobset {
my $startTime = clock_gettime(CLOCK_MONOTONIC);
# Add an ID to eval_* notifications so receivers can correlate
# them.
my $tmpId = "${startTime}.$$";
$db->storage->dbh->do("notify eval_started, ?", undef,
join('\t', $tmpId, $jobset->get_column('project'), $jobset->name));
eval {
checkJobsetWrapped($jobset);
checkJobsetWrapped($jobset, $tmpId);
};
my $checkError = $@;
@ -822,6 +830,7 @@ sub checkJobset {
txn_do($db, sub {
$jobset->update({lastcheckedtime => time});
setJobsetError($jobset, $checkError);
$db->storage->dbh->do("notify eval_failed, ?", undef, join('\t', $tmpId));
}) if !$dryRun;
$failed = 1;
}