hydra-eval-jobs: Transmit original Nix error when handling aggregate jobs

It might happen that a job from the aggregate returned an error!

This is what the vague "[json.exception.type_error.302] type must be string, but is null"
was all about in this instance; there was no `drvPath` to stringify!

So we now actively watch for errors and copy them to the aggregate job.
This commit is contained in:
Samuel Dionne-Riel 2020-10-25 19:15:16 -04:00
parent 68e689cace
commit b5140c1da1

View file

@ -467,10 +467,18 @@ int main(int argc, char * * argv)
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);
auto drvPath2 = store->parseStorePath((std::string) (*job2)["drvPath"]);
auto drv2 = store->readDerivation(drvPath2); if ((*job2).find("error") != (*job2).end()) {
job["constituents"].push_back(store->printStorePath(drvPath2)); if (job.find("error") == job.end()) {
drv.inputDrvs[drvPath2] = {drv2.outputs.begin()->first}; job["error"] = fmt("Errors aggregating aggregate job '%1%'.\n", jobName);
}
job["error"] = fmt("While handling '%1%': %2%\n", jobName2, (std::string) (*job2)["error"]);
} else {
auto drvPath2 = store->parseStorePath((std::string) (*job2)["drvPath"]);
auto drv2 = store->readDerivation(drvPath2);
job["constituents"].push_back(store->printStorePath(drvPath2));
drv.inputDrvs[drvPath2] = {drv2.outputs.begin()->first};
}
} }
std::string drvName(drvPath.name()); std::string drvName(drvPath.name());