Communicate build timeouts to Hydra

This commit is contained in:
Eelco Dolstra 2013-05-09 18:39:04 +02:00
parent 7a03cbf09d
commit 6eba05613a
1 changed files with 11 additions and 7 deletions

View File

@ -172,7 +172,7 @@ public:
/* Cancel the goal. It should wake up its waiters, get rid of any /* Cancel the goal. It should wake up its waiters, get rid of any
running child processes that are being monitored by the worker running child processes that are being monitored by the worker
(important!), etc. */ (important!), etc. */
virtual void cancel() = 0; virtual void cancel(bool timeout) = 0;
protected: protected:
void amDone(ExitCode result); void amDone(ExitCode result);
@ -847,7 +847,7 @@ public:
DerivationGoal(const Path & drvPath, const StringSet & wantedOutputs, Worker & worker, bool repair = false); DerivationGoal(const Path & drvPath, const StringSet & wantedOutputs, Worker & worker, bool repair = false);
~DerivationGoal(); ~DerivationGoal();
void cancel(); void cancel(bool timeout);
void work(); void work();
@ -973,8 +973,10 @@ void DerivationGoal::killChild()
} }
void DerivationGoal::cancel() void DerivationGoal::cancel(bool timeout)
{ {
if (timeout)
printMsg(lvlError, format("@ build-failed %1% - timeout") % drvPath);
killChild(); killChild();
amDone(ecFailed); amDone(ecFailed);
} }
@ -2537,7 +2539,7 @@ public:
SubstitutionGoal(const Path & storePath, Worker & worker, bool repair = false); SubstitutionGoal(const Path & storePath, Worker & worker, bool repair = false);
~SubstitutionGoal(); ~SubstitutionGoal();
void cancel(); void cancel(bool timeout);
void work(); void work();
@ -2578,8 +2580,10 @@ SubstitutionGoal::~SubstitutionGoal()
} }
void SubstitutionGoal::cancel() void SubstitutionGoal::cancel(bool timeout)
{ {
if (timeout)
printMsg(lvlError, format("@ substituter-failed %1% timeout") % storePath);
if (pid != -1) { if (pid != -1) {
pid_t savedPid = pid; pid_t savedPid = pid;
pid.kill(); pid.kill();
@ -3208,7 +3212,7 @@ void Worker::waitForInput()
printMsg(lvlError, printMsg(lvlError,
format("%1% timed out after %2% seconds of silence") format("%1% timed out after %2% seconds of silence")
% goal->getName() % settings.maxSilentTime); % goal->getName() % settings.maxSilentTime);
goal->cancel(); goal->cancel(true);
} }
if (settings.buildTimeout != 0 && if (settings.buildTimeout != 0 &&
@ -3218,7 +3222,7 @@ void Worker::waitForInput()
printMsg(lvlError, printMsg(lvlError,
format("%1% timed out after %2% seconds") format("%1% timed out after %2% seconds")
% goal->getName() % settings.buildTimeout); % goal->getName() % settings.buildTimeout);
goal->cancel(); goal->cancel(true);
} }
} }