forked from lix-project/hydra
Keep track of the number of build steps that are being built
(As opposed to being in the closure copying stage.)
This commit is contained in:
parent
fed71d3fe9
commit
44a2b74f5a
|
@ -114,7 +114,7 @@ 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,
|
||||
RemoteResult & result)
|
||||
RemoteResult & result, counter & nrStepsBuilding)
|
||||
{
|
||||
string base = baseNameOf(drvPath);
|
||||
result.logFile = logDir + "/" + string(base, 0, 2) + "/" + string(base, 2);
|
||||
|
@ -176,7 +176,11 @@ void buildRemote(std::shared_ptr<StoreAPI> store,
|
|||
// FIXME: send maxLogSize.
|
||||
to.flush();
|
||||
result.startTime = time(0);
|
||||
int res = readInt(from);
|
||||
int res;
|
||||
{
|
||||
MaintainCount mc(nrStepsBuilding);
|
||||
res = readInt(from);
|
||||
}
|
||||
result.stopTime = time(0);
|
||||
if (res) {
|
||||
result.errorMsg = (format("%1% on ‘%2%’") % readString(from) % sshName).str();
|
||||
|
|
|
@ -3,6 +3,8 @@
|
|||
#include "store-api.hh"
|
||||
#include "derivations.hh"
|
||||
|
||||
#include "counter.hh"
|
||||
|
||||
struct RemoteResult
|
||||
{
|
||||
enum {
|
||||
|
@ -20,4 +22,4 @@ 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,
|
||||
RemoteResult & result);
|
||||
RemoteResult & result, counter & nrStepsBuilding);
|
||||
|
|
12
src/hydra-queue-runner/counter.hh
Normal file
12
src/hydra-queue-runner/counter.hh
Normal file
|
@ -0,0 +1,12 @@
|
|||
#pragma once
|
||||
|
||||
#include <atomic>
|
||||
|
||||
typedef std::atomic<unsigned int> counter;
|
||||
|
||||
struct MaintainCount
|
||||
{
|
||||
counter & c;
|
||||
MaintainCount(counter & c) : c(c) { c++; }
|
||||
~MaintainCount() { c--; }
|
||||
};
|
|
@ -19,6 +19,7 @@
|
|||
#include "build-remote.hh"
|
||||
#include "sync.hh"
|
||||
#include "pool.hh"
|
||||
#include "counter.hh"
|
||||
|
||||
#include "store-api.hh"
|
||||
#include "derivations.hh"
|
||||
|
@ -43,16 +44,6 @@ bool has(const C & c, const V & v)
|
|||
}
|
||||
|
||||
|
||||
typedef std::atomic<unsigned int> counter;
|
||||
|
||||
struct MaintainCount
|
||||
{
|
||||
counter & c;
|
||||
MaintainCount(counter & c) : c(c) { c++; }
|
||||
~MaintainCount() { c--; }
|
||||
};
|
||||
|
||||
|
||||
typedef enum {
|
||||
bsSuccess = 0,
|
||||
bsFailed = 1,
|
||||
|
@ -252,6 +243,7 @@ private:
|
|||
counter nrBuildsDone{0};
|
||||
counter nrStepsDone{0};
|
||||
counter nrActiveSteps{0};
|
||||
counter nrStepsBuilding{0};
|
||||
counter nrRetries{0};
|
||||
counter maxNrRetries{0};
|
||||
counter nrQueueWakeups{0};
|
||||
|
@ -1094,7 +1086,7 @@ bool State::doBuildStep(std::shared_ptr<StoreAPI> store, Step::ptr step,
|
|||
try {
|
||||
/* FIXME: referring builds may have conflicting timeouts. */
|
||||
buildRemote(store, machine->sshName, machine->sshKey, step->drvPath, step->drv,
|
||||
logDir, build->maxSilentTime, build->buildTimeout, result);
|
||||
logDir, build->maxSilentTime, build->buildTimeout, result, nrStepsBuilding);
|
||||
} catch (Error & e) {
|
||||
result.status = RemoteResult::rrMiscFailure;
|
||||
result.errorMsg = e.msg();
|
||||
|
@ -1432,6 +1424,7 @@ void State::dumpStatus()
|
|||
printMsg(lvlError, format("%1% runnable build steps") % runnable_->size());
|
||||
}
|
||||
printMsg(lvlError, format("%1% active build steps") % nrActiveSteps);
|
||||
printMsg(lvlError, format("%1% build steps currently building") % nrStepsBuilding);
|
||||
printMsg(lvlError, format("%1% builds read from queue") % nrBuildsRead);
|
||||
printMsg(lvlError, format("%1% builds done") % nrBuildsDone);
|
||||
printMsg(lvlError, format("%1% build steps done") % nrStepsDone);
|
||||
|
|
Loading…
Reference in a new issue