From e2a012de8c6ca5e1450cc8e4e99f54c377e6f36c Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Tue, 8 Nov 2016 17:08:54 +0100 Subject: [PATCH] hydra-evaluator: Set jobset error if hydra-eval-jobset dies --- src/hydra-evaluator/hydra-evaluator.cc | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/hydra-evaluator/hydra-evaluator.cc b/src/hydra-evaluator/hydra-evaluator.cc index ec3e6849..3250e00e 100644 --- a/src/hydra-evaluator/hydra-evaluator.cc +++ b/src/hydra-evaluator/hydra-evaluator.cc @@ -232,6 +232,24 @@ struct Evaluator if (jobset.second.pid == pid) { printInfo("evaluation of jobset ā€˜%s:%sā€™ %s", jobset.first.first, jobset.first.second, statusToString(status)); + + try { + + if (!WIFEXITED(status) || WEXITSTATUS(status) > 1) { + auto conn(dbPool.get()); + pqxx::work txn(*conn); + txn.parameterized + ("update Jobsets set errorMsg = $1, errorTime = $2") + (fmt("evaluation %s", statusToString(status))) + (time(0)) + .exec(); + txn.commit(); + } + + } catch (std::exception & e) { + printError("exception setting jobset error: %s", e.what()); + } + jobset.second.pid.release(); maybeDoWork.notify_one(); break;