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;

View file

@ -59,6 +59,8 @@
<span class="error">Cached failure</span>
[% ELSIF step.status == 9 %]
<span class="error">Unsupported system type</span>
[% ELSIF step.status == 10 %]
<span class="error">Log limit exceeded</span>
[% ELSIF step.errormsg %]
<span class="error">Failed: [% HTML.escape(step.errormsg) %]</span>
[% ELSE %]

View file

@ -206,6 +206,8 @@ BLOCK renderBuildStatusIcon;
<img src="[% c.uri_for("/static/images/error_${size}.png") %]" alt="Failed with output" class="build-status" />
[% ELSIF buildstatus == 7 %]
<img src="[% c.uri_for("/static/images/warning_${size}.png") %]" alt="Timed out" class="build-status" />
[% ELSIF buildstatus == 10 %]
<img src="[% c.uri_for("/static/images/warning_${size}.png") %]" alt="Log limit exceeded" class="build-status" />
[% ELSE %]
<img src="[% c.uri_for("/static/images/error_${size}.png") %]" alt="Failed" class="build-status" />
[% END;
@ -235,6 +237,8 @@ BLOCK renderStatus;
<span class="error">Timed out</span>
[% ELSIF buildstatus == 9 %]
<span class="error">Unsupported system type</span>
[% ELSIF buildstatus == 10 %]
<span class="error">Log limit exceeded</span>
[% ELSE %]
<span class="error">Aborted</span>
(Hydra failure; see <a href="#nix-error">below</a>)

View file

@ -195,6 +195,7 @@ create table Builds (
-- 6 = failure with output
-- 7 = timed out
-- 9 = unsupported system type
-- 10 = log limit exceeded
buildStatus integer,
errorMsg text, -- error message in case of a Nix failure
@ -266,6 +267,7 @@ create table BuildSteps (
-- 7 = timed out
-- 8 = cached failure
-- 9 = unsupported system type
-- 10 = log limit exceeded
status integer,
errorMsg text,