forked from lix-project/hydra
hydra-eval-jobs: Identify unexpected errors in handling aggregate jobs
The vague "[json.exception.type_error.302] type must be string, but is null" is **absolutely** unhelpful in the way Hydra currently handles it on evaluation. This is handling *unexpected* errors only; the following commit will handle the specific instance of the previously mentioned error.
This commit is contained in:
parent
be709d450b
commit
68e689cace
|
@ -442,12 +442,16 @@ int main(int argc, char * * argv)
|
||||||
for (auto i = state->jobs.begin(); i != state->jobs.end(); ++i) {
|
for (auto i = state->jobs.begin(); i != state->jobs.end(); ++i) {
|
||||||
auto jobName = i.key();
|
auto jobName = i.key();
|
||||||
auto & job = i.value();
|
auto & job = i.value();
|
||||||
|
// For the error message
|
||||||
|
std::string lastTriedJobName = i.key();
|
||||||
|
|
||||||
auto named = job.find("namedConstituents");
|
auto named = job.find("namedConstituents");
|
||||||
if (named == job.end()) continue;
|
if (named == job.end()) continue;
|
||||||
|
|
||||||
|
try {
|
||||||
if (myArgs.dryRun) {
|
if (myArgs.dryRun) {
|
||||||
for (std::string jobName2 : *named) {
|
for (std::string jobName2 : *named) {
|
||||||
|
lastTriedJobName = jobName2;
|
||||||
auto job2 = state->jobs.find(jobName2);
|
auto job2 = state->jobs.find(jobName2);
|
||||||
if (job2 == state->jobs.end())
|
if (job2 == state->jobs.end())
|
||||||
throw Error("aggregate job '%s' references non-existent job '%s'", jobName, jobName2);
|
throw Error("aggregate job '%s' references non-existent job '%s'", jobName, jobName2);
|
||||||
|
@ -459,6 +463,7 @@ int main(int argc, char * * argv)
|
||||||
auto drv = store->readDerivation(drvPath);
|
auto drv = store->readDerivation(drvPath);
|
||||||
|
|
||||||
for (std::string jobName2 : *named) {
|
for (std::string jobName2 : *named) {
|
||||||
|
lastTriedJobName = jobName2;
|
||||||
auto job2 = state->jobs.find(jobName2);
|
auto job2 = state->jobs.find(jobName2);
|
||||||
if (job2 == state->jobs.end())
|
if (job2 == state->jobs.end())
|
||||||
throw Error("aggregate job '%s' references non-existent job '%s'", jobName, jobName2);
|
throw Error("aggregate job '%s' references non-existent job '%s'", jobName, jobName2);
|
||||||
|
@ -482,6 +487,13 @@ int main(int argc, char * * argv)
|
||||||
job["drvPath"] = newDrvPath;
|
job["drvPath"] = newDrvPath;
|
||||||
job["outputs"]["out"] = store->printStorePath(outPath);
|
job["outputs"]["out"] = store->printStorePath(outPath);
|
||||||
}
|
}
|
||||||
|
} catch (std::exception & e) {
|
||||||
|
// Print more information to help debugging.
|
||||||
|
printError("Unexpected error in hydra-eval-jobs when handling job '%s', when producing aggregate job '%s':", lastTriedJobName, jobName);
|
||||||
|
|
||||||
|
// And throw the original exception!
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
|
||||||
job.erase("namedConstituents");
|
job.erase("namedConstituents");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue