hydra-evaluator: Fix error handling in fetching inputs

This caused bogus "cannot find the input containing the job
expression" errors.
This commit is contained in:
Eelco Dolstra 2015-09-11 13:49:46 +02:00
parent c1dd3fe4be
commit aea1ed7445

View file

@ -108,17 +108,17 @@ sub checkJobsetWrapped {
eval { eval {
fetchInputs($project, $jobset, $inputInfo); fetchInputs($project, $jobset, $inputInfo);
}; };
my $fetchError = $@;
Net::Statsd::increment("hydra.evaluator.checkouts"); Net::Statsd::increment("hydra.evaluator.checkouts");
my $checkoutStop = clock_gettime(CLOCK_REALTIME); my $checkoutStop = clock_gettime(CLOCK_REALTIME);
Net::Statsd::timing("hydra.evaluator.checkout_time", int(($checkoutStop - $checkoutStart) * 1000)); Net::Statsd::timing("hydra.evaluator.checkout_time", int(($checkoutStop - $checkoutStart) * 1000));
if ($@) { if ($fetchError) {
Net::Statsd::increment("hydra.evaluator.failed_checkouts"); Net::Statsd::increment("hydra.evaluator.failed_checkouts");
my $msg = $@; print STDERR $fetchError;
print STDERR $msg;
txn_do($db, sub { txn_do($db, sub {
$jobset->update({ lastcheckedtime => time, fetcherrormsg => $msg }) if !$dryRun; $jobset->update({ lastcheckedtime => time, fetcherrormsg => $fetchError }) if !$dryRun;
}); });
return; return;
} }
@ -290,17 +290,17 @@ sub checkJobset {
eval { eval {
checkJobsetWrapped($jobset); checkJobsetWrapped($jobset);
}; };
my $checkError = $@;
my $stopTime = clock_gettime(CLOCK_REALTIME); my $stopTime = clock_gettime(CLOCK_REALTIME);
Net::Statsd::timing("hydra.evaluator.total_time", int(($stopTime - $startTime) * 1000)); Net::Statsd::timing("hydra.evaluator.total_time", int(($stopTime - $startTime) * 1000));
my $failed = 0; my $failed = 0;
if ($@) { if ($checkError) {
my $msg = $@; print STDERR $checkError;
print STDERR $msg;
txn_do($db, sub { txn_do($db, sub {
$jobset->update({lastcheckedtime => time}); $jobset->update({lastcheckedtime => time});
setJobsetError($jobset, $msg); setJobsetError($jobset, $checkError);
}) if !$dryRun; }) if !$dryRun;
$failed = 1; $failed = 1;
} }