Re-implement log size limits

The old queue runner already had this. However, we now store "log
limit exceeded" as a separate status code in the database.
This commit is contained in:
Eelco Dolstra
2015-10-06 17:35:08 +02:00
parent 82504fe010
commit 8e8e31ce86
6 changed files with 25 additions and 8 deletions

View File

@ -155,17 +155,19 @@ void State::buildRemote(std::shared_ptr<StoreAPI> store,
/* Handshake. */
bool sendDerivation = true;
unsigned int remoteVersion;
try {
to << SERVE_MAGIC_1 << SERVE_PROTOCOL_VERSION;
to << SERVE_MAGIC_1 << 0x202;
to.flush();
unsigned int magic = readInt(from);
if (magic != SERVE_MAGIC_2)
throw Error(format("protocol mismatch with nix-store --serve on %1%") % machine->sshName);
unsigned int version = readInt(from);
if (GET_PROTOCOL_MAJOR(version) != 0x200)
remoteVersion = readInt(from);
if (GET_PROTOCOL_MAJOR(remoteVersion) != 0x200)
throw Error(format("unsupported nix-store --serve protocol version on %1%") % machine->sshName);
if (GET_PROTOCOL_MINOR(version) >= 1)
if (GET_PROTOCOL_MINOR(remoteVersion) >= 1)
sendDerivation = false;
} catch (EndOfFile & e) {
@ -237,10 +239,12 @@ void State::buildRemote(std::shared_ptr<StoreAPI> store,
printMsg(lvlDebug, format("building %1% on %2%") % step->drvPath % machine->sshName);
if (sendDerivation)
to << cmdBuildPaths << PathSet({step->drvPath}) << maxSilentTime << buildTimeout;
to << cmdBuildPaths << PathSet({step->drvPath});
else
to << cmdBuildDerivation << step->drvPath << basicDrv << maxSilentTime << buildTimeout;
// FIXME: send maxLogSize.
to << cmdBuildDerivation << step->drvPath << basicDrv;
to << maxSilentTime << buildTimeout;
if (GET_PROTOCOL_MINOR(remoteVersion) >= 2)
to << 64 * 1024 * 1024; // == maxLogSize
to.flush();
result.startTime = time(0);

View File

@ -300,10 +300,12 @@ bool State::doBuildStep(std::shared_ptr<StoreAPI> store, Step::ptr step,
BuildStatus buildStatus =
result.status == BuildResult::TimedOut ? bsTimedOut :
result.status == BuildResult::LogLimitExceeded ? bsLogLimitExceeded :
result.canRetry() ? bsAborted :
bsFailed;
BuildStepStatus buildStepStatus =
result.status == BuildResult::TimedOut ? bssTimedOut :
result.status == BuildResult::LogLimitExceeded ? bssLogLimitExceeded :
result.canRetry() ? bssAborted :
bssFailed;
@ -312,7 +314,8 @@ bool State::doBuildStep(std::shared_ptr<StoreAPI> store, Step::ptr step,
if (result.status == BuildResult::PermanentFailure ||
result.status == BuildResult::TransientFailure ||
result.status == BuildResult::CachedFailure ||
result.status == BuildResult::TimedOut)
result.status == BuildResult::TimedOut ||
result.status == BuildResult::LogLimitExceeded)
result.errorMsg = "";
/* Create failed build steps for every build that depends

View File

@ -30,6 +30,7 @@ typedef enum {
bsFailedWithOutput = 6,
bsTimedOut = 7,
bsUnsupported = 9,
bsLogLimitExceeded = 10,
} BuildStatus;
@ -40,6 +41,7 @@ typedef enum {
bssTimedOut = 7,
bssCachedFailure = 8,
bssUnsupported = 9,
bssLogLimitExceeded = 10,
bssBusy = 100, // not stored
} BuildStepStatus;