Keep stats for the Hydra auto scaler

"hydra-queue-runner --status" now prints how many runnable and running
build steps exist for each machine type. This allows additional
machines to be provisioned based on the Hydra load.
This commit is contained in:
Eelco Dolstra
2015-08-17 13:50:41 +02:00
parent 69e9f73cf6
commit d571e44b86
5 changed files with 91 additions and 8 deletions

View File

@ -6,18 +6,20 @@
using namespace nix;
void State::builder(Step::ptr step, Machine::ptr machine, std::shared_ptr<MaintainCount> reservation)
void State::builder(MachineReservation::ptr reservation)
{
bool retry = true;
MaintainCount mc(nrActiveSteps);
auto step = reservation->step;
try {
auto store = openStore(); // FIXME: pool
retry = doBuildStep(store, step, machine);
retry = doBuildStep(store, step, reservation->machine);
} catch (std::exception & e) {
printMsg(lvlError, format("uncaught exception building %1% on %2%: %3%")
% step->drvPath % machine->sshName % e.what());
% step->drvPath % reservation->machine->sshName % e.what());
}
/* Release the machine and wake up the dispatcher. */