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:
@ -453,6 +453,8 @@ void State::dumpStatus(Connection & conn, bool log)
|
||||
nested.attr(m->sshName);
|
||||
JSONObject nested2(out);
|
||||
nested2.attr("currentJobs", s->currentJobs);
|
||||
if (s->currentJobs == 0)
|
||||
nested2.attr("idleSince", s->idleSince);
|
||||
nested2.attr("nrStepsDone", s->nrStepsDone);
|
||||
if (m->state->nrStepsDone) {
|
||||
nested2.attr("totalStepTime", s->totalStepTime);
|
||||
@ -473,6 +475,19 @@ void State::dumpStatus(Connection & conn, bool log)
|
||||
nested2.attr("seconds", jobset.second->getSeconds());
|
||||
}
|
||||
}
|
||||
{
|
||||
root.attr("machineTypes");
|
||||
JSONObject nested(out);
|
||||
auto machineTypes_(machineTypes.lock());
|
||||
for (auto & i : *machineTypes_) {
|
||||
nested.attr(i.first);
|
||||
JSONObject nested2(out);
|
||||
nested2.attr("runnable", i.second.runnable);
|
||||
nested2.attr("running", i.second.running);
|
||||
if (i.second.running == 0)
|
||||
nested2.attr("lastActive", i.second.lastActive);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (log) printMsg(lvlInfo, format("status: %1%") % out.str());
|
||||
|
Reference in New Issue
Block a user