From 7889aef7927f61c1aaa54d1afcfe564b7bc69005 Mon Sep 17 00:00:00 2001 From: Samuel Dionne-Riel Date: Mon, 30 Mar 2020 14:36:16 -0400 Subject: [PATCH] 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 76299b9174d7cba06427220166dc4707b43d407d) --- src/hydra-eval-jobs/hydra-eval-jobs.cc | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/hydra-eval-jobs/hydra-eval-jobs.cc b/src/hydra-eval-jobs/hydra-eval-jobs.cc index 4a4084e0..f3367e11 100644 --- a/src/hydra-eval-jobs/hydra-eval-jobs.cc +++ b/src/hydra-eval-jobs/hydra-eval-jobs.cc @@ -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 });