hydra-queue-runner: do not assume reservation
is available when build step throws unexpectedly
Some checks failed
Test / tests (pull_request) Has been cancelled
Some checks failed
Test / tests (pull_request) Has been cancelled
`reservation` might be null when an uncaught exception has been thrown. We copy the data we need to report the error. Signed-off-by: Raito Bezarius <raito@lix.systems>
This commit is contained in:
parent
a9a2679793
commit
1f9d8dc0a6
|
@ -28,6 +28,9 @@ void State::builder(MachineReservation::ptr reservation)
|
|||
|
||||
{
|
||||
auto activeStep = std::make_shared<ActiveStep>();
|
||||
auto machineSshName = reservation->machine->sshName;
|
||||
auto drvPath = reservation->step->drvPath;
|
||||
|
||||
activeStep->step = reservation->step;
|
||||
activeSteps_.lock()->insert(activeStep);
|
||||
|
||||
|
@ -39,9 +42,12 @@ void State::builder(MachineReservation::ptr reservation)
|
|||
auto destStore = getDestStore();
|
||||
res = doBuildStep(destStore, reservation, activeStep);
|
||||
} catch (std::exception & e) {
|
||||
if (!reservation) {
|
||||
printMsg(lvlTalkative, "machine '%s' has been released earlier (e.g. at copying outputs phase)", machineSshName);
|
||||
}
|
||||
printMsg(lvlError, "uncaught exception building ‘%s’ on ‘%s’: %s",
|
||||
localStore->printStorePath(reservation->step->drvPath),
|
||||
reservation->machine->sshName,
|
||||
localStore->printStorePath(drvPath),
|
||||
machineSshName,
|
||||
e.what());
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue