hydra-queue-runner: Use cmdBuildDerivation

[?]
Jul 20, 2015, 11:45 PM
NAYQT2GTCJPBFRSK7CBFX655F2NGTBPICJSCYG2CSCQ5NRDHZG6QC

Dependencies

  • [2] UFUAO7ND Improve logging for aborts
  • [3] N4IROACV Move buildRemote() into State
  • [4] NJJ7H64S Very basic multi-threaded queue runner
  • [5] WHULPA6S Handle failure with output
  • [6] 6TY4LNHH Finish copyClosure
  • [7] YZAI5GQU Implement a database connection pool
  • [8] YHP5DSOO Improve parsing of hydra-build-products
  • [9] LE4VZIY5 More stats
  • [10] MB3TISH2 Rate-limit the number of threads copying closures at the same time
  • [11] 5LBMP7GA Fix remote building
  • [12] HJOEIMLR Refactor
  • [13] OCZ4LSGG Automatically retry aborted builds
  • [14] QJRDO2B4 Simplify retry handling
  • [15] 63W4T5PU hydra-queue-runner: More stats
  • [16] GKZN4UV7 Make the queue monitor more robust, and better debug output
  • [17] ENXUSMSV Make concurrency more robust
  • [18] 7LB6QBXY Keep track of the number of build steps that are being built
  • [19] 24BMQDZA Start of single-process hydra-queue-runner
  • [20] GS4BE6TB Asynchronously compress build logs
  • [21] 62MQPRXC Pass null values to libpqxx properly
  • [22] 5AIYUMTB Basic remote building
  • [23] HPJKBFZ4 Handle concurrent finishing of the same build
  • [24] HHOMBU7G hydra-queue-runner: Implement timeouts
  • [25] 7I7XHQAE Fix sending notifications in the successful case
  • [26] E7WP35SF Create build step for non-top-level cached failures
  • [27] OG3Z3QGC Namespace cleanup
  • [28] A2GL5FOZ Moar stats
  • [29] HUUZFPPK Fix race between the queue monitor and the builder threads
  • [30] RYTQLATY Keep track of failed paths in the Hydra database

Change contents

  • replacement in src/hydra-queue-runner/build-remote.cc at line 84
    [4.1844][4.1844:1954](),[4.1954][4.0:31]()
    writeInt(cmdQueryValidPaths, to);
    writeInt(1, to); // == lock paths
    writeInt(useSubstitutes, to);
    writeStrings(closure, to);
    [4.1844]
    [4.1984]
    to << cmdQueryValidPaths << 1 << useSubstitutes << closure;
  • replacement in src/hydra-queue-runner/build-remote.cc at line 104
    [4.286][4.286:320]()
    writeInt(cmdImportPaths, to);
    [4.286]
    [4.320]
    to << cmdImportPaths;
  • replacement in src/hydra-queue-runner/build-remote.cc at line 116
    [4.2563][4.2563:2664]()
    writeInt(cmdExportPaths, to);
    writeInt(0, to); // == don't sign
    writeStrings(paths, to);
    [4.2563]
    [4.2664]
    to << cmdExportPaths << 0 << paths;
  • edit in src/hydra-queue-runner/build-remote.cc at line 148
    [4.3414]
    [4.79]
    bool sendDerivation = true;
  • replacement in src/hydra-queue-runner/build-remote.cc at line 150
    [4.89][4.89:172]()
    writeInt(SERVE_MAGIC_1, to);
    writeInt(SERVE_PROTOCOL_VERSION, to);
    [4.89]
    [4.172]
    to << SERVE_MAGIC_1 << SERVE_PROTOCOL_VERSION;
  • edit in src/hydra-queue-runner/build-remote.cc at line 159
    [3.655]
    [4.587]
    if (GET_PROTOCOL_MINOR(version) >= 1)
    sendDerivation = false;
  • replacement in src/hydra-queue-runner/build-remote.cc at line 167
    [4.7][4.7:36](),[4.36][3.745:782]()
    /* Gather the inputs. */
    PathSet inputs({step->drvPath});
    [4.7]
    [3.782]
    /* Gather the inputs. If the remote side is Nix <= 1.9, we have to
    copy the entire closure of ‘drvPath’, as well the required
    outputs of the input derivations. On Nix > 1.9, we only need to
    copy the immediate sources of the derivation and the required
    outputs of the input derivations. */
    PathSet inputs;
    if (sendDerivation)
    inputs.insert(step->drvPath);
    else
    for (auto & p : step->drv.inputSrcs)
    inputs.insert(p);
  • replacement in src/hydra-queue-runner/build-remote.cc at line 184
    [4.252][4.252:324]()
    if (i != drv2.outputs.end()) inputs.insert(i->second.path);
    [4.252]
    [4.324]
    if (i == drv2.outputs.end()) continue;
    inputs.insert(i->second.path);
  • replacement in src/hydra-queue-runner/build-remote.cc at line 203
    [4.941][4.4176:4209](),[3.1092][4.4176:4209](),[4.4176][4.4176:4209](),[4.4209][3.1093:1141](),[3.1141][4.113:209](),[4.4251][4.113:209]()
    writeInt(cmdBuildPaths, to);
    writeStrings(PathSet({step->drvPath}), to);
    writeInt(maxSilentTime, to);
    writeInt(buildTimeout, to);
    // FIXME: send maxLogSize.
    [3.1092]
    [4.4352]
    if (sendDerivation)
    to << cmdBuildPaths << PathSet({step->drvPath}) << maxSilentTime << buildTimeout;
    else
    to << cmdBuildDerivation << step->drvPath << step->drv << maxSilentTime << buildTimeout;
    // FIXME: send maxLogSize.
  • edit in src/hydra-queue-runner/build-remote.cc at line 210
    [4.4368]
    [4.4368]
  • replacement in src/hydra-queue-runner/build-remote.cc at line 218
    [4.4460][4.4460:4475](),[4.4475][3.1142:1242](),[3.1242][4.4566:4785](),[4.4566][4.4566:4785]()
    if (res) {
    result.errorMsg = (format("%1% on ‘%2%’") % readString(from) % machine->sshName).str();
    if (res == 100) result.status = RemoteResult::rrPermanentFailure;
    else if (res == 101) result.status = RemoteResult::rrTimedOut;
    else result.status = RemoteResult::rrMiscFailure;
    return;
    [4.4460]
    [4.4785]
    if (sendDerivation) {
    if (res) {
    result.errorMsg = (format("%1% on ‘%2%’") % readString(from) % machine->sshName).str();
    if (res == 100) result.status = BuildResult::PermanentFailure;
    else if (res == 101) result.status = BuildResult::TimedOut;
    else result.status = BuildResult::MiscFailure;
    return;
    }
    result.status = BuildResult::Built;
    } else {
    result.status = (BuildResult::Status) res;
    result.errorMsg = readString(from);
    if (!result.success()) return;
  • edit in src/hydra-queue-runner/build-remote.cc at line 234
    [4.4792]
    [4.4792]
    /* If the path was substituted or already valid, then we didn't
    get a build log. */
    if (result.status == BuildResult::Substituted || result.status == BuildResult::AlreadyValid) {
    unlink(result.logFile.c_str());
    result.logFile = "";
    }
  • edit in src/hydra-queue-runner/build-remote.cc at line 255
    [4.5160][4.5160:5205]()
    result.status = RemoteResult::rrSuccess;
  • replacement in src/hydra-queue-runner/build-result.cc at line 10
    [4.555][4.0:84]()
    BuildResult getBuildResult(std::shared_ptr<StoreAPI> store, const Derivation & drv)
    [4.555]
    [4.606]
    BuildOutput getBuildOutput(std::shared_ptr<StoreAPI> store, const Derivation & drv)
  • replacement in src/hydra-queue-runner/build-result.cc at line 12
    [4.608][4.608:629]()
    BuildResult res;
    [4.608]
    [4.629]
    BuildOutput res;
  • replacement in src/hydra-queue-runner/build-result.hh at line 18
    [4.4597][4.4597:4616]()
    struct BuildResult
    [4.4597]
    [4.4616]
    struct BuildOutput
  • replacement in src/hydra-queue-runner/build-result.hh at line 32
    [4.4741][4.105:200]()
    BuildResult getBuildResult(std::shared_ptr<nix::StoreAPI> store, const nix::Derivation & drv);
    [4.4741]
    BuildOutput getBuildOutput(std::shared_ptr<nix::StoreAPI> store, const nix::Derivation & drv);
  • replacement in src/hydra-queue-runner/hydra-queue-runner.cc at line 317
    [4.11162][4.2006:2064]()
    BuildResult res = getBuildResult(store, drv);
    [4.11162]
    [4.9877]
    BuildOutput res = getBuildOutput(store, drv);
  • replacement in src/hydra-queue-runner/hydra-queue-runner.cc at line 825
    [4.13268][4.99:120]()
    BuildResult res;
    [4.13268]
    [4.120]
    BuildOutput res;
  • replacement in src/hydra-queue-runner/hydra-queue-runner.cc at line 835
    [4.511][4.511:569]()
    result.status = RemoteResult::rrPermanentFailure;
    [4.511]
    [4.569]
    result.status = BuildResult::CachedFailure;
  • replacement in src/hydra-queue-runner/hydra-queue-runner.cc at line 852
    [4.1138][4.1138:1195]()
    result.status = RemoteResult::rrMiscFailure;
    [4.1138]
    [4.1195]
    result.status = BuildResult::MiscFailure;
  • replacement in src/hydra-queue-runner/hydra-queue-runner.cc at line 856
    [4.16007][4.1330:1424]()
    if (result.status == RemoteResult::rrSuccess) res = getBuildResult(store, step->drv);
    [4.16007]
    [4.1469]
    if (result.success()) res = getBuildOutput(store, step->drv);
  • replacement in src/hydra-queue-runner/hydra-queue-runner.cc at line 873
    [4.107][4.4407:4463](),[4.4407][4.4407:4463](),[4.4463][2.0:92]()
    if (result.status == RemoteResult::rrMiscFailure) {
    printMsg(lvlError, format("irregular failure building ‘%1%’ on ‘%2%’: %3%")
    [4.107]
    [2.92]
    if (result.canRetry()) {
    printMsg(lvlError, format("possibly transient failure building ‘%1%’ on ‘%2%’: %3%")
  • replacement in src/hydra-queue-runner/hydra-queue-runner.cc at line 891
    [4.4555][4.3017:3069]()
    if (result.status == RemoteResult::rrSuccess) {
    [4.4555]
    [4.3069]
    if (result.success()) {
  • replacement in src/hydra-queue-runner/hydra-queue-runner.cc at line 935
    [4.4737][4.4737:4801]()
    markSucceededBuild(txn, b, res, build != b,
    [4.4737]
    [4.4801]
    markSucceededBuild(txn, b, res, build != b || result.status != BuildResult::Built,
  • replacement in src/hydra-queue-runner/hydra-queue-runner.cc at line 1018
    [4.6913][4.6913:7104]()
    result.status == RemoteResult::rrPermanentFailure ? bsFailed :
    result.status == RemoteResult::rrTimedOut ? bsTimedOut :
    bsAborted;
    [4.6913]
    [4.7104]
    result.status == BuildResult::TimedOut ? bsTimedOut :
    result.canRetry() ? bsAborted :
    bsFailed;
  • replacement in src/hydra-queue-runner/hydra-queue-runner.cc at line 1022
    [4.7154][4.7154:7348]()
    result.status == RemoteResult::rrPermanentFailure ? bssFailed :
    result.status == RemoteResult::rrTimedOut ? bssTimedOut :
    bssAborted;
    [4.7154]
    [4.7348]
    result.status == BuildResult::TimedOut ? bssTimedOut :
    result.canRetry() ? bssAborted :
    bssFailed;
  • replacement in src/hydra-queue-runner/hydra-queue-runner.cc at line 1026
    [4.7349][4.7349:7420]()
    /* For regular failures, we don't care about the error
    [4.7349]
    [4.7420]
    /* For standard failures, we don't care about the error
  • replacement in src/hydra-queue-runner/hydra-queue-runner.cc at line 1028
    [4.7451][4.7451:7519]()
    if (buildStatus != bsAborted) result.errorMsg = "";
    [4.7451]
    [4.7519]
    if (result.status == BuildResult::PermanentFailure ||
    result.status == BuildResult::TransientFailure ||
    result.status == BuildResult::CachedFailure ||
    result.status == BuildResult::TimedOut)
    result.errorMsg = "";
  • replacement in src/hydra-queue-runner/hydra-queue-runner.cc at line 1068
    [4.9334][4.9334:9423]()
    if (!cachedFailure && result.status == RemoteResult::rrPermanentFailure)
    [4.9334]
    [4.9423]
    if (!cachedFailure && result.status == BuildResult::PermanentFailure)
  • replacement in src/hydra-queue-runner/hydra-queue-runner.cc at line 1110
    [4.17740][4.17740:17824]()
    const BuildResult & res, bool isCachedBuild, time_t startTime, time_t stopTime)
    [4.17740]
    [4.17824]
    const BuildOutput & res, bool isCachedBuild, time_t startTime, time_t stopTime)
  • replacement in src/hydra-queue-runner/state.hh at line 46
    [4.1921][3.1553:1573]()
    struct RemoteResult
    [4.1921]
    [3.1573]
    struct RemoteResult : nix::BuildResult
  • edit in src/hydra-queue-runner/state.hh at line 48
    [3.1575][3.1575:1747]()
    enum {
    rrSuccess = 0,
    rrPermanentFailure = 1,
    rrTimedOut = 2,
    rrMiscFailure = 3
    } status = rrMiscFailure;
    std::string errorMsg;
  • edit in src/hydra-queue-runner/state.hh at line 50
    [3.1810]
    [3.1810]
    bool canRetry()
    {
    return status == TransientFailure || status == MiscFailure;
    }
  • replacement in src/hydra-queue-runner/state.hh at line 59
    [4.1934][4.1934:1954]()
    struct BuildResult;
    [4.1934]
    [4.1954]
    struct BuildOutput;
  • replacement in src/hydra-queue-runner/state.hh at line 284
    [4.8543][4.8543:8632]()
    const BuildResult & res, bool isCachedBuild, time_t startTime, time_t stopTime);
    [4.8543]
    [4.8632]
    const BuildOutput & res, bool isCachedBuild, time_t startTime, time_t stopTime);