forked from lix-project/hydra
Immediately abort builds that require an unsupported system type
This commit is contained in:
parent
bf87d3a6ed
commit
541fbd62cc
|
@ -128,6 +128,13 @@ struct Machine
|
||||||
auto currentJobs_(currentJobs.lock());
|
auto currentJobs_(currentJobs.lock());
|
||||||
*currentJobs_ = 0;
|
*currentJobs_ = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool supportsStep(Step::ptr step)
|
||||||
|
{
|
||||||
|
if (systemTypes.find(step->drv.platform) == systemTypes.end()) return false;
|
||||||
|
// FIXME: check features
|
||||||
|
return true;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -452,7 +459,7 @@ void State::getQueuedBuilds(Connection & conn, std::shared_ptr<StoreAPI> store,
|
||||||
|
|
||||||
if (!store->isValidPath(build->drvPath)) {
|
if (!store->isValidPath(build->drvPath)) {
|
||||||
/* Derivation has been GC'ed prematurely. */
|
/* Derivation has been GC'ed prematurely. */
|
||||||
printMsg(lvlInfo, format("aborting GC'ed build %1%") % build->id);
|
printMsg(lvlError, format("aborting GC'ed build %1%") % build->id);
|
||||||
pqxx::work txn(conn);
|
pqxx::work txn(conn);
|
||||||
txn.parameterized
|
txn.parameterized
|
||||||
("update Builds set finished = 1, busy = 0, buildStatus = $2, startTime = $3, stopTime = $3, errorMsg = $4 where id = $1")
|
("update Builds set finished = 1, busy = 0, buildStatus = $2, startTime = $3, stopTime = $3, errorMsg = $4 where id = $1")
|
||||||
|
@ -483,6 +490,32 @@ void State::getQueuedBuilds(Connection & conn, std::shared_ptr<StoreAPI> store,
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* If any step has an unsupported system type, then fail the
|
||||||
|
build. */
|
||||||
|
bool allSupported = true;
|
||||||
|
for (auto & r : newRunnable) {
|
||||||
|
bool supported = false;
|
||||||
|
{
|
||||||
|
auto machines_(machines.lock()); // FIXME: use shared_mutex
|
||||||
|
for (auto & m : *machines_)
|
||||||
|
if (m->supportsStep(r)) { supported = true; break; }
|
||||||
|
}
|
||||||
|
if (!supported) { allSupported = false; break; }
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!allSupported) {
|
||||||
|
printMsg(lvlError, format("aborting unsupported build %1%") % build->id);
|
||||||
|
pqxx::work txn(conn);
|
||||||
|
txn.parameterized
|
||||||
|
("update Builds set finished = 1, busy = 0, buildStatus = $2, startTime = $3, stopTime = $3, errorMsg = $4 where id = $1")
|
||||||
|
(build->id)
|
||||||
|
((int) bsAborted)
|
||||||
|
(time(0))
|
||||||
|
("unsupported system type").exec();
|
||||||
|
txn.commit();
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
/* Note: if we exit this scope prior to this, the build and
|
/* Note: if we exit this scope prior to this, the build and
|
||||||
all newly created steps are destroyed. */
|
all newly created steps are destroyed. */
|
||||||
|
|
||||||
|
@ -763,8 +796,7 @@ MachineReservation::ptr State::findMachine(Step::ptr step)
|
||||||
auto machines_(machines.lock());
|
auto machines_(machines.lock());
|
||||||
|
|
||||||
for (auto & machine : *machines_) {
|
for (auto & machine : *machines_) {
|
||||||
if (!has(machine->systemTypes, step->drv.platform)) continue;
|
if (!machine->supportsStep(step)) continue;
|
||||||
// FIXME: check features
|
|
||||||
{
|
{
|
||||||
auto currentJobs_(machine->currentJobs.lock());
|
auto currentJobs_(machine->currentJobs.lock());
|
||||||
if (*currentJobs_ >= machine->maxJobs) continue;
|
if (*currentJobs_ >= machine->maxJobs) continue;
|
||||||
|
|
Loading…
Reference in a new issue