From 5019fceb20532f6a5554e242179c0e83638d570b Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 15 Jun 2015 15:07:04 +0200 Subject: [PATCH] Add a error type for "unsupported system type" --- src/hydra-queue-runner/hydra-queue-runner.cc | 32 +++++++++++--------- src/root/build.tt | 2 ++ src/root/common.tt | 4 ++- src/sql/hydra.sql | 2 ++ 4 files changed, 25 insertions(+), 15 deletions(-) diff --git a/src/hydra-queue-runner/hydra-queue-runner.cc b/src/hydra-queue-runner/hydra-queue-runner.cc index c1bfe8ae..e6677512 100644 --- a/src/hydra-queue-runner/hydra-queue-runner.cc +++ b/src/hydra-queue-runner/hydra-queue-runner.cc @@ -33,6 +33,7 @@ typedef enum { bsDepFailed = 2, bsAborted = 3, bsFailedWithOutput = 6, + bsUnsupported = 9, } BuildStatus; @@ -40,6 +41,7 @@ typedef enum { bssSuccess = 0, bssFailed = 1, bssAborted = 4, + bssUnsupported = 9, bssBusy = 100, // not stored } BuildStepStatus; @@ -343,7 +345,7 @@ int State::createBuildStep(pqxx::work & txn, time_t startTime, Build::ptr build, (propagatedFrom, propagatedFrom != 0) (errorMsg, errorMsg != "") (startTime, status != bssBusy) - (machine, machine != "").exec(); + (machine).exec(); for (auto & output : step->drv.outputs) txn.parameterized @@ -500,21 +502,23 @@ void State::getQueuedBuilds(Connection & conn, std::shared_ptr store, for (auto & m : *machines_) if (m->supportsStep(r)) { supported = true; break; } } - if (!supported) { allSupported = false; break; } + if (!supported) { + allSupported = false; + printMsg(lvlError, format("aborting unsupported build %1%") % build->id); + pqxx::work txn(conn); + time_t now = time(0); + txn.parameterized + ("update Builds set finished = 1, busy = 0, buildStatus = $2, startTime = $3, stopTime = $3 where id = $1") + (build->id) + ((int) bsUnsupported) + (now).exec(); + createBuildStep(txn, now, build, r, "", bssUnsupported); + txn.commit(); + 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; - } + if (!allSupported) continue; /* Note: if we exit this scope prior to this, the build and all newly created steps are destroyed. */ diff --git a/src/root/build.tt b/src/root/build.tt index 3923715a..dc689cdd 100644 --- a/src/root/build.tt +++ b/src/root/build.tt @@ -56,6 +56,8 @@ Timed out [% ELSIF step.status == 8 %] Cached failure + [% ELSIF step.status == 9 %] + Unsupported system type [% ELSIF step.errormsg %] Failed: [% HTML.escape(step.errormsg) %] [% ELSE %] diff --git a/src/root/common.tt b/src/root/common.tt index 8ebdbd47..f4425772 100644 --- a/src/root/common.tt +++ b/src/root/common.tt @@ -198,7 +198,7 @@ BLOCK renderBuildStatusIcon; Failed [% ELSIF buildstatus == 2 || buildstatus == 5 %] Dependency failed - [% ELSIF buildstatus == 3 %] + [% ELSIF buildstatus == 3 || buildstatus == 9 %] Aborted [% ELSIF buildstatus == 4 %] Cancelled @@ -229,6 +229,8 @@ BLOCK renderStatus; Cancelled by user [% ELSIF buildstatus == 6 %] Build failed (with result) + [% ELSIF buildstatus == 9 %] + Unsupported system type [% ELSE %] Aborted (Hydra failure; see below) diff --git a/src/sql/hydra.sql b/src/sql/hydra.sql index 83178c25..cfeea893 100644 --- a/src/sql/hydra.sql +++ b/src/sql/hydra.sql @@ -180,6 +180,7 @@ create table Builds ( -- 4 = build cancelled (removed from queue; never built) -- 5 = build not done because a dependency failed previously (obsolete) -- 6 = failure with output + -- 9 = unsupported system type buildStatus integer, errorMsg text, -- error message in case of a Nix failure @@ -227,6 +228,7 @@ create table BuildSteps ( -- 4 = aborted -- 7 = timed out -- 8 = cached failure + -- 9 = unsupported system type status integer, errorMsg text,