From f46a21e16e167950e09ed9185ea6fe047ac10c82 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Fri, 21 Jul 2017 17:22:11 +0200 Subject: [PATCH] Slight cleanup --- src/hydra-queue-runner/state.hh | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/src/hydra-queue-runner/state.hh b/src/hydra-queue-runner/state.hh index e5058593..38489f27 100644 --- a/src/hydra-queue-runner/state.hh +++ b/src/hydra-queue-runner/state.hh @@ -238,13 +238,27 @@ struct Machine bool supportsStep(Step::ptr step) { - if (systemTypes.find(step->drv.platform) == systemTypes.end()) return false; + /* Check that this machine is of the type required by the + step. */ + if (!systemTypes.count(step->drv.platform)) return false; + + /* Check that the step requires all mandatory features of this + machine. (Thus, a machine with the mandatory "benchmark" + feature will *only* execute steps that require + "benchmark".) The "preferLocalBuild" bit of a step is + mapped to the "local" feature; thus machines that have + "local" as a mandatory feature will only do + preferLocalBuild steps. */ for (auto & f : mandatoryFeatures) - if (step->requiredSystemFeatures.find(f) == step->requiredSystemFeatures.end() - && !(step->preferLocalBuild && f == "local")) + if (!step->requiredSystemFeatures.count(f) + && !(f == "local" && step->preferLocalBuild)) return false; + + /* Check that the machine supports all features required by + the step. */ for (auto & f : step->requiredSystemFeatures) - if (supportedFeatures.find(f) == supportedFeatures.end()) return false; + if (!supportedFeatures.count(f)) return false; + return true; } };