1
0
Fork 0
mirror of https://github.com/NixOS/hydra.git synced 2024-10-18 17:02:28 -04:00

Keep track of requiredSystemFeatures in the machine stats

For example, steps that require the "kvm" feature may require a
different kind of machine to be provisioned. This can also be used to
require performance-sensitive tests to run on a particular kind of
machine, e.g., by setting requiredSystemFeatures to something like
"ec2-i2.8xlarge".
This commit is contained in:
Eelco Dolstra 2015-08-17 14:37:57 +02:00
parent a6e3cb53b9
commit ea1eb2e3fb
3 changed files with 11 additions and 6 deletions

View file

@ -158,7 +158,7 @@ system_time State::doDispatch()
++i; ++i;
runnablePerType[step->drv.platform]++; runnablePerType[step->systemType]++;
/* Skip previously failed steps that aren't ready /* Skip previously failed steps that aren't ready
to be retried. */ to be retried. */
@ -219,8 +219,8 @@ system_time State::doDispatch()
break; break;
} else ++i; } else ++i;
assert(removed); assert(removed);
assert(runnablePerType[step->drv.platform]); assert(runnablePerType[step->systemType]);
runnablePerType[step->drv.platform]--; runnablePerType[step->systemType]--;
} }
/* Make a slot reservation and start a thread to /* Make a slot reservation and start a thread to
@ -291,7 +291,7 @@ State::MachineReservation::MachineReservation(State & state, Step::ptr step, Mac
{ {
auto machineTypes_(state.machineTypes.lock()); auto machineTypes_(state.machineTypes.lock());
(*machineTypes_)[step->drv.platform].running++; (*machineTypes_)[step->systemType].running++;
} }
} }
@ -305,7 +305,7 @@ State::MachineReservation::~MachineReservation()
{ {
auto machineTypes_(state.machineTypes.lock()); auto machineTypes_(state.machineTypes.lock());
auto & machineType = (*machineTypes_)[step->drv.platform]; auto & machineType = (*machineTypes_)[step->systemType];
assert(machineType.running); assert(machineType.running);
machineType.running--; machineType.running--;
if (machineType.running == 0) if (machineType.running == 0)

View file

@ -359,10 +359,14 @@ Step::ptr State::createStep(std::shared_ptr<StoreAPI> store, const Path & drvPat
it's not runnable yet, and other threads won't make it it's not runnable yet, and other threads won't make it
runnable while step->created == false. */ runnable while step->created == false. */
step->drv = readDerivation(drvPath); step->drv = readDerivation(drvPath);
step->systemType = step->drv.platform;
{ {
auto i = step->drv.env.find("requiredSystemFeatures"); auto i = step->drv.env.find("requiredSystemFeatures");
if (i != step->drv.env.end()) if (i != step->drv.env.end()) {
step->requiredSystemFeatures = tokenizeString<std::set<std::string>>(i->second); step->requiredSystemFeatures = tokenizeString<std::set<std::string>>(i->second);
step->systemType += ":";
step->systemType += concatStringsSep(",", step->requiredSystemFeatures);
}
} }
auto attr = step->drv.env.find("preferLocalBuild"); auto attr = step->drv.env.find("preferLocalBuild");

View file

@ -135,6 +135,7 @@ struct Step
nix::Derivation drv; nix::Derivation drv;
std::set<std::string> requiredSystemFeatures; std::set<std::string> requiredSystemFeatures;
bool preferLocalBuild; bool preferLocalBuild;
std::string systemType; // concatenation of drv.platform and requiredSystemFeatures
struct State struct State
{ {