hydra-eval-jobs: Mirror eval errors in STDERR

Otherwise, errors will not be shown to end-users, which makes debugging
long evals pretty much impossible.

(cherry picked from commit 76299b9174)
This commit is contained in:
Samuel Dionne-Riel 2020-03-30 14:36:16 -04:00 committed by Eelco Dolstra
parent a7540b141d
commit 7889aef792
No known key found for this signature in database
GPG key ID: 8170B4726D7198DE

View file

@ -238,7 +238,12 @@ static void worker(
else throw TypeError("attribute '%s' is %s, which is not supported", attrPath, showType(*v));
} catch (EvalError & e) {
// Transmits the error we got from the previous evaluation
// in the JSON output.
reply["error"] = filterANSIEscapes(e.msg(), true);
// Don't forget to print it into the STDERR log, this is
// what's shown in the Hydra UI.
printError("error: %s", reply["error"]);
}
writeLine(to.get(), reply.dump());
@ -328,6 +333,9 @@ int main(int argc, char * * argv)
nlohmann::json err;
err["error"] = e.what();
writeLine(to->get(), err.dump());
// Don't forget to print it into the STDERR log, this is
// what's shown in the Hydra UI.
printError("error: %s", err["error"]);
}
},
ProcessOptions { .allowVfork = false });