Revert "Fix unhelpful error messages in aggregate jobs."

[?]
Oct 24, 2021, 2:23 AM
VA3Z62HQORGCVMKEDRX7CDC3RE7ZCEUOD5F3GVJDIF2SG2TXTJ4QC

Dependencies

  • [2] KTH67GR4 hydra-eval-jobs: Transmit original Nix error when handling aggregate jobs
  • [3] D4G756UK hydra-eval-jobs: Identify unexpected errors in handling aggregate jobs
  • [4] 4DHGJ2FL Fix build
  • [5] VUYJ47EV hydra-eval-jobs: Parallelize
  • [6] 6NUK6AZA Fix build
  • [7] NQPGIRXX Revert "hydra-eval-jobs -> nix eval-hydra-jobs"

Change contents

  • edit in src/hydra-eval-jobs/hydra-eval-jobs.cc at line 441
    [3.12686][3.0:89]()
    // For the error message
    std::string lastTriedJobName = i.key();
  • replacement in src/hydra-eval-jobs/hydra-eval-jobs.cc at line 445
    [3.12790][3.90:820](),[3.143][3.13376:13377](),[3.820][3.13376:13377](),[3.13376][3.13376:13377](),[3.13377][3.821:1166](),[3.1166][2.0:804](),[2.804][3.1501:1523](),[3.1501][3.1501:1523]()
    try {
    if (myArgs.dryRun) {
    for (std::string jobName2 : *named) {
    lastTriedJobName = jobName2;
    auto job2 = state->jobs.find(jobName2);
    if (job2 == state->jobs.end())
    throw Error("aggregate job '%s' references non-existent job '%s'", jobName, jobName2);
    std::string drvPath2 = (*job2)["drvPath"];
    job["constituents"].push_back(drvPath2);
    }
    } else {
    auto drvPath = store->parseStorePath((std::string) job["drvPath"]);
    auto drv = store->readDerivation(drvPath);
    for (std::string jobName2 : *named) {
    lastTriedJobName = jobName2;
    auto job2 = state->jobs.find(jobName2);
    if (job2 == state->jobs.end())
    throw Error("aggregate job '%s' references non-existent job '%s'", jobName, jobName2);
    if ((*job2).find("error") != (*job2).end()) {
    if (job.find("error") == job.end()) {
    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};
    }
    }
    [3.12790]
    [3.13961]
    if (myArgs.dryRun) {
    for (std::string jobName2 : *named) {
    auto job2 = state->jobs.find(jobName2);
    if (job2 == state->jobs.end())
    throw Error("aggregate job '%s' references non-existent job '%s'", jobName, jobName2);
    std::string drvPath2 = (*job2)["drvPath"];
    job["constituents"].push_back(drvPath2);
    }
    } else {
    auto drvPath = store->parseStorePath((std::string) job["drvPath"]);
    auto drv = store->readDerivation(drvPath);
  • replacement in src/hydra-eval-jobs/hydra-eval-jobs.cc at line 457
    [3.13962][3.1524:2180]()
    std::string drvName(drvPath.name());
    assert(hasSuffix(drvName, drvExtension));
    drvName.resize(drvName.size() - drvExtension.size());
    auto h = std::get<Hash>(hashDerivationModulo(*store, drv, true));
    auto outPath = store->makeOutputPath("out", h, drvName);
    drv.env["out"] = store->printStorePath(outPath);
    drv.outputs.insert_or_assign("out", DerivationOutput { .output = DerivationOutputInputAddressed { .path = outPath } });
    auto newDrvPath = store->printStorePath(writeDerivation(*store, drv));
    [3.13962]
    [3.2180]
    for (std::string jobName2 : *named) {
    auto job2 = state->jobs.find(jobName2);
    if (job2 == state->jobs.end())
    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);
    job["constituents"].push_back(store->printStorePath(drvPath2));
    drv.inputDrvs[drvPath2] = {drv2.outputs.begin()->first};
    }
  • replacement in src/hydra-eval-jobs/hydra-eval-jobs.cc at line 467
    [3.2181][3.2181:2293]()
    debug("rewrote aggregate derivation %s -> %s", store->printStorePath(drvPath), newDrvPath);
    [3.2181]
    [3.14561]
    std::string drvName(drvPath.name());
    assert(hasSuffix(drvName, drvExtension));
    drvName.resize(drvName.size() - drvExtension.size());
    auto h = std::get<Hash>(hashDerivationModulo(*store, drv, true));
    auto outPath = store->makeOutputPath("out", h, drvName);
    drv.env["out"] = store->printStorePath(outPath);
    drv.outputs.insert_or_assign("out", DerivationOutput { .output = DerivationOutputInputAddressed { .path = outPath } });
    auto newDrvPath = store->printStorePath(writeDerivation(*store, drv));
  • replacement in src/hydra-eval-jobs/hydra-eval-jobs.cc at line 476
    [3.14562][3.2294:2694]()
    job["drvPath"] = newDrvPath;
    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);
    [3.14562]
    [3.14647]
    debug("rewrote aggregate derivation %s -> %s", store->printStorePath(drvPath), newDrvPath);
  • replacement in src/hydra-eval-jobs/hydra-eval-jobs.cc at line 478
    [3.14648][3.2695:2771]()
    // And throw the original exception!
    throw;
    [3.14648]
    [3.14765]
    job["drvPath"] = newDrvPath;
    job["outputs"]["out"] = store->printStorePath(outPath);