hydra-evaluator: Add some debug code
This commit is contained in:
parent
a2dc92d871
commit
63306aaf5a
2 changed files with 31 additions and 7 deletions
|
@ -330,10 +330,20 @@ sub evalJobs {
|
||||||
my $nixExprFullPath = $nixExprInput->{storePath} . "/" . $nixExprPath;
|
my $nixExprFullPath = $nixExprInput->{storePath} . "/" . $nixExprPath;
|
||||||
|
|
||||||
my $evaluator = ($exprType eq "guile") ? "hydra-eval-guile-jobs" : "hydra-eval-jobs";
|
my $evaluator = ($exprType eq "guile") ? "hydra-eval-guile-jobs" : "hydra-eval-jobs";
|
||||||
print STDERR "evaluator ${evaluator}\n";
|
|
||||||
|
|
||||||
(my $res, my $jobsJSON, my $stderr) = captureStdoutStderr(10800,
|
my @cmd = ($evaluator, $nixExprFullPath, "--gc-roots-dir", getGCRootsDir, "-j", 1, inputsToArgs($inputInfo, $exprType));
|
||||||
$evaluator, $nixExprFullPath, "--gc-roots-dir", getGCRootsDir, "-j", 1, inputsToArgs($inputInfo, $exprType));
|
|
||||||
|
if (defined $ENV{'HYDRA_DEBUG'}) {
|
||||||
|
sub escape {
|
||||||
|
my $s = $_;
|
||||||
|
$s =~ s/'/'\\''/g;
|
||||||
|
return "'" . $s . "'";
|
||||||
|
}
|
||||||
|
my @escaped = map escape, @cmd;
|
||||||
|
print STDERR "evaluator: @escaped\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
(my $res, my $jobsJSON, my $stderr) = captureStdoutStderr(10800, @cmd);
|
||||||
die "$evaluator returned " . ($res & 127 ? "signal $res" : "exit code " . ($res >> 8))
|
die "$evaluator returned " . ($res & 127 ? "signal $res" : "exit code " . ($res >> 8))
|
||||||
. ":\n" . ($stderr ? $stderr : "(no output)\n")
|
. ":\n" . ($stderr ? $stderr : "(no output)\n")
|
||||||
if $res;
|
if $res;
|
||||||
|
|
|
@ -25,6 +25,7 @@ my $plugins = [Hydra::Plugin->instantiate(db => $db, config => $config)];
|
||||||
# Don't check a jobset more than once every five minutes.
|
# Don't check a jobset more than once every five minutes.
|
||||||
my $minCheckInterval = 5 * 60;
|
my $minCheckInterval = 5 * 60;
|
||||||
|
|
||||||
|
my $dryRun = defined $ENV{'HYDRA_DRY_RUN'};
|
||||||
|
|
||||||
|
|
||||||
sub fetchInputs {
|
sub fetchInputs {
|
||||||
|
@ -112,7 +113,7 @@ sub checkJobsetWrapped {
|
||||||
my $msg = $@;
|
my $msg = $@;
|
||||||
print STDERR $msg;
|
print STDERR $msg;
|
||||||
txn_do($db, sub {
|
txn_do($db, sub {
|
||||||
$jobset->update({ lastcheckedtime => time, fetcherrormsg => $msg });
|
$jobset->update({ lastcheckedtime => time, fetcherrormsg => $msg }) if !$dryRun;
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -124,7 +125,7 @@ sub checkJobsetWrapped {
|
||||||
my @args = ($jobset->nixexprinput, $jobset->nixexprpath, inputsToArgs($inputInfo, $exprType));
|
my @args = ($jobset->nixexprinput, $jobset->nixexprpath, inputsToArgs($inputInfo, $exprType));
|
||||||
my $argsHash = sha256_hex("@args");
|
my $argsHash = sha256_hex("@args");
|
||||||
my $prevEval = getPrevJobsetEval($db, $jobset, 0);
|
my $prevEval = getPrevJobsetEval($db, $jobset, 0);
|
||||||
if (defined $prevEval && $prevEval->hash eq $argsHash) {
|
if (defined $prevEval && $prevEval->hash eq $argsHash && !$dryRun) {
|
||||||
print STDERR " jobset is unchanged, skipping\n";
|
print STDERR " jobset is unchanged, skipping\n";
|
||||||
txn_do($db, sub {
|
txn_do($db, sub {
|
||||||
$jobset->update({ lastcheckedtime => time, fetcherrormsg => undef });
|
$jobset->update({ lastcheckedtime => time, fetcherrormsg => undef });
|
||||||
|
@ -137,6 +138,18 @@ sub checkJobsetWrapped {
|
||||||
my ($jobs, $nixExprInput) = evalJobs($inputInfo, $exprType, $jobset->nixexprinput, $jobset->nixexprpath);
|
my ($jobs, $nixExprInput) = evalJobs($inputInfo, $exprType, $jobset->nixexprinput, $jobset->nixexprpath);
|
||||||
my $evalStop = time;
|
my $evalStop = time;
|
||||||
|
|
||||||
|
if ($dryRun) {
|
||||||
|
foreach my $name (keys %{$jobs}) {
|
||||||
|
my $job = $jobs->{$name};
|
||||||
|
if (defined $job->{drvPath}) {
|
||||||
|
print STDERR "good job $name: $job->{drvPath}\n";
|
||||||
|
} else {
|
||||||
|
print STDERR "failed job $name: $job->{error}\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
$jobs->{$_}->{jobName} = $_ for keys %{$jobs};
|
$jobs->{$_}->{jobName} = $_ for keys %{$jobs};
|
||||||
|
|
||||||
my $jobOutPathMap = {};
|
my $jobOutPathMap = {};
|
||||||
|
@ -268,7 +281,7 @@ sub checkJobset {
|
||||||
txn_do($db, sub {
|
txn_do($db, sub {
|
||||||
$jobset->update({lastcheckedtime => time});
|
$jobset->update({lastcheckedtime => time});
|
||||||
setJobsetError($jobset, $msg);
|
setJobsetError($jobset, $msg);
|
||||||
});
|
}) if !$dryRun;
|
||||||
$failed = 1;
|
$failed = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -280,8 +293,9 @@ sub checkJobset {
|
||||||
my $new = $jobset->get_from_storage();
|
my $new = $jobset->get_from_storage();
|
||||||
$jobset->update({ triggertime => undef })
|
$jobset->update({ triggertime => undef })
|
||||||
if $new->triggertime == $triggerTime;
|
if $new->triggertime == $triggerTime;
|
||||||
});
|
}) if !$dryRun;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $failed;
|
return $failed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue