From 06b76ab275caa600f702fdb8e79ea2e312c57a67 Mon Sep 17 00:00:00 2001 From: aszlig Date: Tue, 21 Apr 2015 07:45:50 +0200 Subject: [PATCH] Add isChannel column and meta attribute. This is to properly separate channels from regular jobs and also make sure that we can always iterate on them, no matter whether the build has failed. The reason why we were not able to do this until now was because we were iterating on the build products, and whenever some constituent of a channel job has failed, we didn't get a build output. So whenever there is a meta.isHydraChannel, we can now properly distinguish it from the other jobs. I still don't have any clue, why "make -C src/sql update-dbix" without *any* modifications tries to create additional schema definitions. But I've checked the md5sums of the existing schema definitions and they don't seem to match, so it seems that they already have been tampered with. Signed-off-by: aszlig --- src/hydra-eval-jobs/hydra-eval-jobs.cc | 1 + src/lib/Hydra/Helper/AddBuilds.pm | 1 + src/lib/Hydra/Schema/Builds.pm | 12 ++++++++++-- src/sql/hydra.sql | 1 + src/sql/upgrade-42.sql | 1 + 5 files changed, 14 insertions(+), 2 deletions(-) create mode 100644 src/sql/upgrade-42.sql diff --git a/src/hydra-eval-jobs/hydra-eval-jobs.cc b/src/hydra-eval-jobs/hydra-eval-jobs.cc index 7fadef71..ff3eef7c 100644 --- a/src/hydra-eval-jobs/hydra-eval-jobs.cc +++ b/src/hydra-eval-jobs/hydra-eval-jobs.cc @@ -127,6 +127,7 @@ static void findJobsWrapped(EvalState & state, JSONObject & top, res.attr("schedulingPriority", drv.queryMetaInt("schedulingPriority", 100)); res.attr("timeout", drv.queryMetaInt("timeout", 36000)); res.attr("maxSilent", drv.queryMetaInt("maxSilent", 7200)); + res.attr("isChannel", drv.queryMetaBool("isHydraChannel", false)); /* If this is an aggregate, then get its constituents. */ Bindings::iterator a = v.attrs->find(state.symbols.create("_hydraAggregate")); diff --git a/src/lib/Hydra/Helper/AddBuilds.pm b/src/lib/Hydra/Helper/AddBuilds.pm index 773b850d..aa7aa343 100644 --- a/src/lib/Hydra/Helper/AddBuilds.pm +++ b/src/lib/Hydra/Helper/AddBuilds.pm @@ -448,6 +448,7 @@ sub checkBuild { , busy => 0 , locker => "" , iscurrent => 1 + , ischannel => $buildInfo->{isChannel} }); $build->buildoutputs->create({ name => $_, path => $buildInfo->{outputs}->{$_} }) diff --git a/src/lib/Hydra/Schema/Builds.pm b/src/lib/Hydra/Schema/Builds.pm index b9dc0437..a22cd670 100644 --- a/src/lib/Hydra/Schema/Builds.pm +++ b/src/lib/Hydra/Schema/Builds.pm @@ -116,6 +116,12 @@ __PACKAGE__->table("Builds"); default_value: 36000 is_nullable: 1 +=head2 ischannel + + data_type: 'integer' + default_value: 0 + is_nullable: 1 + =head2 iscurrent data_type: 'integer' @@ -239,6 +245,8 @@ __PACKAGE__->add_columns( { data_type => "integer", default_value => 3600, is_nullable => 1 }, "timeout", { data_type => "integer", default_value => 36000, is_nullable => 1 }, + "ischannel", + { data_type => "integer", default_value => 0, is_nullable => 1 }, "iscurrent", { data_type => "integer", default_value => 0, is_nullable => 1 }, "nixexprinput", @@ -558,8 +566,8 @@ __PACKAGE__->many_to_many( ); -# Created by DBIx::Class::Schema::Loader v0.07043 @ 2015-08-10 15:10:41 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:rjifgnPtjY96MaQ7eiGzaA +# Created by DBIx::Class::Schema::Loader v0.07043 @ 2015-09-10 17:34:23 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:JRelp13Cyfi+QVxC92xuqQ __PACKAGE__->has_many( "dependents", diff --git a/src/sql/hydra.sql b/src/sql/hydra.sql index 15766402..2b3414ec 100644 --- a/src/sql/hydra.sql +++ b/src/sql/hydra.sql @@ -157,6 +157,7 @@ create table Builds ( maxsilent integer default 3600, -- meta.maxsilent timeout integer default 36000, -- meta.timeout + isChannel integer default 0, -- meta.isHydraChannel isCurrent integer default 0, -- Copy of the nixExprInput/nixExprPath fields of the jobset that diff --git a/src/sql/upgrade-42.sql b/src/sql/upgrade-42.sql new file mode 100644 index 00000000..558a1bea --- /dev/null +++ b/src/sql/upgrade-42.sql @@ -0,0 +1 @@ +alter table Builds add column isChannel integer not null default 0;