Move buildRemote() into State

[?]
Jul 7, 2015, 8:25 AM
N4IROACVZ4MU73J5SM6WXJMKQSFR3VN5SOKENNNZNEGMTGB2Q3HAC

Dependencies

  • [2] HJOEIMLR Refactor
  • [3] 24BMQDZA Start of single-process hydra-queue-runner
  • [4] A2GL5FOZ Moar stats
  • [5] 5AIYUMTB Basic remote building
  • [6] OCZ4LSGG Automatically retry aborted builds
  • [7] 7VQ4ALFY Update "make check" for the new queue runner
  • [8] 5LBMP7GA Fix remote building
  • [9] MB3TISH2 Rate-limit the number of threads copying closures at the same time
  • [10] GS4BE6TB Asynchronously compress build logs
  • [11] 7LB6QBXY Keep track of the number of build steps that are being built
  • [12] HHOMBU7G hydra-queue-runner: Implement timeouts
  • [13] ENXUSMSV Make concurrency more robust
  • [14] LE4VZIY5 More stats
  • [15] YZAI5GQU Implement a database connection pool
  • [16] RYTQLATY Keep track of failed paths in the Hydra database

Change contents

  • file deletion: build-remote.hh (----------)
    [3.187][3.5784:5823](),[3.5823][3.5249:5249]()
    #pragma once
    #include "store-api.hh"
    #include "derivations.hh"
    struct RemoteResult
    {
    enum {
    rrSuccess = 0,
    rrPermanentFailure = 1,
    rrTimedOut = 2,
    rrMiscFailure = 3
    } status = rrMiscFailure;
    std::string errorMsg;
    time_t startTime = 0, stopTime = 0;
    };
    void buildRemote(std::shared_ptr<nix::StoreAPI> store,
    const std::string & sshName, const std::string & sshKey,
    const nix::Path & drvPath, const nix::Derivation & drv,
    const nix::Path & logDir, unsigned int maxSilentTime, unsigned int buildTimeout,
    TokenServer & copyClosureTokenServer, RemoteResult & result,
    counter & nrStepsBuilding, counter & nrStepsCopyingTo, counter & nrStepsCopyingFrom,
    counter & bytesSent, counter & bytesReceived);
    nix::Path logFile;
    #include "counter.hh"
    #include "token-server.hh"
  • replacement in src/hydra-queue-runner/Makefile.am at line 4
    [3.85][2.0:91]()
    build-remote.hh build-result.hh counter.hh pool.hh sync.hh token-server.hh state.hh db.hh
    [3.85]
    [3.322]
    build-result.hh counter.hh pool.hh sync.hh token-server.hh state.hh db.hh
  • edit in src/hydra-queue-runner/build-remote.cc at line 6
    [3.172][3.172:200]()
    #include "build-remote.hh"
  • edit in src/hydra-queue-runner/build-remote.cc at line 7
    [3.201][3.201:220]()
    #include "util.hh"
  • edit in src/hydra-queue-runner/build-remote.cc at line 9
    [3.268]
    [3.268]
    #include "state.hh"
    #include "util.hh"
  • replacement in src/hydra-queue-runner/build-remote.cc at line 143
    [3.2721][3.2721:2872](),[3.2872][3.0:85](),[3.85][3.0:65](),[3.65][3.319:458]()
    void buildRemote(std::shared_ptr<StoreAPI> store,
    const string & sshName, const string & sshKey,
    const Path & drvPath, const Derivation & drv,
    const nix::Path & logDir, unsigned int maxSilentTime, unsigned int buildTimeout,
    TokenServer & copyClosureTokenServer, RemoteResult & result,
    counter & nrStepsBuilding, counter & nrStepsCopyingTo, counter & nrStepsCopyingFrom,
    counter & bytesSent, counter & bytesReceived)
    [3.2721]
    [3.2925]
    void State::buildRemote(std::shared_ptr<StoreAPI> store,
    Machine::ptr machine, Step::ptr step,
    unsigned int maxSilentTime, unsigned int buildTimeout,
    RemoteResult & result)
  • replacement in src/hydra-queue-runner/build-remote.cc at line 148
    [3.2927][3.2927:2966]()
    string base = baseNameOf(drvPath);
    [3.2927]
    [3.0]
    string base = baseNameOf(step->drvPath);
  • replacement in src/hydra-queue-runner/build-remote.cc at line 158
    [3.3264][3.3264:3315]()
    openConnection(sshName, sshKey, logFD, child);
    [3.3264]
    [3.3315]
    openConnection(machine->sshName, machine->sshKey, logFD, child);
  • replacement in src/hydra-queue-runner/build-remote.cc at line 173
    [3.273][3.273:379]()
    throw Error(format("protocol mismatch with ‘nix-store --serve’ on ‘%1%’") % sshName);
    [3.273]
    [3.379]
    throw Error(format("protocol mismatch with ‘nix-store --serve’ on ‘%1%’") % machine->sshName);
  • replacement in src/hydra-queue-runner/build-remote.cc at line 176
    [3.475][3.475:587]()
    throw Error(format("unsupported ‘nix-store --serve’ protocol version on ‘%1%’") % sshName);
    [3.475]
    [3.587]
    throw Error(format("unsupported ‘nix-store --serve’ protocol version on ‘%1%’") % machine->sshName);
  • replacement in src/hydra-queue-runner/build-remote.cc at line 180
    [3.406][3.406:485]()
    throw Error(format("cannot connect to ‘%1%’: %2%") % sshName % s);
    [3.406]
    [3.0]
    throw Error(format("cannot connect to ‘%1%’: %2%") % machine->sshName % s);
  • replacement in src/hydra-queue-runner/build-remote.cc at line 184
    [3.36][3.36:108]()
    PathSet inputs({drvPath});
    for (auto & input : drv.inputDrvs) {
    [3.36]
    [3.108]
    PathSet inputs({step->drvPath});
    for (auto & input : step->drv.inputDrvs) {
  • replacement in src/hydra-queue-runner/build-remote.cc at line 194
    [3.3911][3.459:594]()
    if (sshName != "localhost") {
    printMsg(lvlDebug, format("sending closure of ‘%1%’ to ‘%2%’") % drvPath % sshName);
    [3.3911]
    [3.161]
    if (machine->sshName != "localhost") {
    printMsg(lvlDebug, format("sending closure of ‘%1%’ to ‘%2%’") % step->drvPath % machine->sshName);
  • replacement in src/hydra-queue-runner/build-remote.cc at line 203
    [3.4089][3.854:941]()
    printMsg(lvlDebug, format("building ‘%1%’ on ‘%2%’") % drvPath % sshName);
    [3.4089]
    [3.4176]
    printMsg(lvlDebug, format("building ‘%1%’ on ‘%2%’") % step->drvPath % machine->sshName);
  • replacement in src/hydra-queue-runner/build-remote.cc at line 205
    [3.4209][3.4209:4251]()
    writeStrings(PathSet({drvPath}), to);
    [3.4209]
    [3.113]
    writeStrings(PathSet({step->drvPath}), to);
  • replacement in src/hydra-queue-runner/build-remote.cc at line 218
    [3.4475][3.4475:4566]()
    result.errorMsg = (format("%1% on ‘%2%’") % readString(from) % sshName).str();
    [3.4475]
    [3.4566]
    result.errorMsg = (format("%1% on ‘%2%’") % readString(from) % machine->sshName).str();
  • replacement in src/hydra-queue-runner/build-remote.cc at line 226
    [3.4825][3.679:816]()
    if (sshName != "localhost") {
    printMsg(lvlDebug, format("copying outputs of ‘%1%’ from ‘%2%’") % drvPath % sshName);
    [3.4825]
    [3.816]
    if (machine->sshName != "localhost") {
    printMsg(lvlDebug, format("copying outputs of ‘%1%’ from ‘%2%’") % step->drvPath % machine->sshName);
  • replacement in src/hydra-queue-runner/build-remote.cc at line 229
    [3.841][3.841:883]()
    for (auto & output : drv.outputs)
    [3.841]
    [3.883]
    for (auto & output : step->drv.outputs)
  • edit in src/hydra-queue-runner/hydra-queue-runner.cc at line 11
    [3.4943][3.5824:5851]()
    #include "build-remote.hh"
  • replacement in src/hydra-queue-runner/hydra-queue-runner.cc at line 850
    [3.1069][3.1069:1161](),[3.1161][3.1174:1265](),[3.1265][3.1242:1364]()
    buildRemote(store, machine->sshName, machine->sshKey, step->drvPath, step->drv,
    logDir, build->maxSilentTime, build->buildTimeout, copyClosureTokenServer,
    result, nrStepsBuilding, nrStepsCopyingTo, nrStepsCopyingFrom,
    bytesSent, bytesReceived);
    [3.1069]
    [3.1108]
    buildRemote(store, machine, step, build->maxSilentTime, build->buildTimeout, result);
  • edit in src/hydra-queue-runner/state.hh at line 49
    [2.1921]
    [2.1921]
    struct RemoteResult
    {
    enum {
    rrSuccess = 0,
    rrPermanentFailure = 1,
    rrTimedOut = 2,
    rrMiscFailure = 3
    } status = rrMiscFailure;
    std::string errorMsg;
    time_t startTime = 0, stopTime = 0;
    nix::Path logFile;
    };
  • edit in src/hydra-queue-runner/state.hh at line 282
    [2.8479]
    [2.8479]
    void buildRemote(std::shared_ptr<nix::StoreAPI> store,
    Machine::ptr machine, Step::ptr step,
    unsigned int maxSilentTime, unsigned int buildTimeout,
    RemoteResult & result);