hydra-eval-jobs: Identify unexpected errors in handling aggregate jobs

[?]
Oct 25, 2020, 10:50 PM
D4G756UKRXYU6QEKD6TGN2VAL7PDJMLBMQALHKDPZU3I6U5KVTYQC

Dependencies

Change contents

  • edit in src/hydra-eval-jobs/hydra-eval-jobs.cc at line 445
    [3.12686]
    [3.12686]
    // For the error message
    std::string lastTriedJobName = i.key();
  • replacement in src/hydra-eval-jobs/hydra-eval-jobs.cc at line 451
    [3.12790][3.12790:13262](),[3.13262][3.0:143]()
    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);
    [3.12790]
    [3.13376]
    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);
  • replacement in src/hydra-eval-jobs/hydra-eval-jobs.cc at line 465
    [3.13377][3.13377:13653](),[3.13653][3.144:463](),[3.463][3.13943:13961](),[3.13943][3.13943:13961]()
    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};
    }
    [3.13377]
    [3.13961]
    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);
    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 476
    [3.13962][3.464:517](),[3.517][3.14038:14166](),[3.14038][3.14038:14166](),[3.14166][3.0:82](),[3.82][3.14232:14370](),[3.14232][3.14232:14370](),[3.14370][3.518:654](),[3.654][2.0:87]()
    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.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));
    debug("rewrote aggregate derivation %s -> %s", store->printStorePath(drvPath), newDrvPath);
  • replacement in src/hydra-eval-jobs/hydra-eval-jobs.cc at line 487
    [3.14562][3.655:763]()
    debug("rewrote aggregate derivation %s -> %s", store->printStorePath(drvPath), newDrvPath);
    [3.14562]
    [3.14647]
    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);
  • replacement in src/hydra-eval-jobs/hydra-eval-jobs.cc at line 494
    [3.14648][3.14648:14765]()
    job["drvPath"] = newDrvPath;
    job["outputs"]["out"] = store->printStorePath(outPath);
    [3.14648]
    [3.14765]
    // And throw the original exception!
    throw;