diff --git a/src/hydra-queue-runner/dispatcher.cc b/src/hydra-queue-runner/dispatcher.cc index f5d9d3e3..6d738ded 100644 --- a/src/hydra-queue-runner/dispatcher.cc +++ b/src/hydra-queue-runner/dispatcher.cc @@ -231,11 +231,11 @@ system_time State::doDispatch() sort(machinesSorted.begin(), machinesSorted.end(), [](const MachineInfo & a, const MachineInfo & b) -> bool { - float ta = std::round(a.currentJobs / a.machine->speedFactorFloat); - float tb = std::round(b.currentJobs / b.machine->speedFactorFloat); + float ta = std::round(a.currentJobs / a.machine->speedFactor); + float tb = std::round(b.currentJobs / b.machine->speedFactor); return ta != tb ? ta < tb : - a.machine->speedFactorFloat != b.machine->speedFactorFloat ? a.machine->speedFactorFloat > b.machine->speedFactorFloat : + a.machine->speedFactor != b.machine->speedFactor ? a.machine->speedFactor > b.machine->speedFactor : a.currentJobs > b.currentJobs; }); diff --git a/src/hydra-queue-runner/hydra-queue-runner.cc b/src/hydra-queue-runner/hydra-queue-runner.cc index 5fbcb641..3d48f3d7 100644 --- a/src/hydra-queue-runner/hydra-queue-runner.cc +++ b/src/hydra-queue-runner/hydra-queue-runner.cc @@ -155,16 +155,16 @@ void State::parseMachines(const std::string & contents) auto machine = std::make_shared<::Machine>(nix::Machine { // `storeUri`, not yet used "", - // `systemTypes`, not yet used - {}, + // `systemTypes` + tokenizeString(tokens[1], ","), // `sshKey` tokens[2] == "-" ? "" : tokens[2], // `maxJobs` tokens[3] != "" ? string2Int(tokens[3]).value() : 1, - // `speedFactor`, not yet used - 1, + // `speedFactor` + atof(tokens[4].c_str()), // `supportedFeatures` std::move(supportedFeatures), // `mandatoryFeatures` @@ -176,8 +176,6 @@ void State::parseMachines(const std::string & contents) }); machine->sshName = tokens[0]; - machine->systemTypesSet = tokenizeString(tokens[1], ","); - machine->speedFactorFloat = atof(tokens[4].c_str()); /* Re-use the State object of the previous machine with the same name. */ @@ -638,7 +636,7 @@ void State::dumpStatus(Connection & conn) json machine = { {"enabled", m->enabled}, - {"systemTypes", m->systemTypesSet}, + {"systemTypes", m->systemTypes}, {"supportedFeatures", m->supportedFeatures}, {"mandatoryFeatures", m->mandatoryFeatures}, {"nrStepsDone", s->nrStepsDone.load()}, diff --git a/src/hydra-queue-runner/state.hh b/src/hydra-queue-runner/state.hh index f6d9d5a9..cda238ae 100644 --- a/src/hydra-queue-runner/state.hh +++ b/src/hydra-queue-runner/state.hh @@ -244,14 +244,6 @@ struct Machine : nix::Machine we are not yet used to, but once we are, we don't need this. */ std::string sshName; - /* TODO Get rid once `nix::Machine::systemTypes` is a set not - vector. */ - std::set systemTypesSet; - - /* TODO Get rid once `nix::Machine::systemTypes` is a `float` not - an `int`. */ - float speedFactorFloat = 1.0; - struct State { typedef std::shared_ptr ptr; counter currentJobs{0}; @@ -278,7 +270,7 @@ struct Machine : nix::Machine { /* Check that this machine is of the type required by the step. */ - if (!systemTypesSet.count(step->drv->platform == "builtin" ? nix::settings.thisSystem : step->drv->platform)) + if (!systemTypes.count(step->drv->platform == "builtin" ? nix::settings.thisSystem : step->drv->platform)) return false; /* Check that the step requires all mandatory features of this