From b7e03351cb8aabb1ad0213ae663295915b513f39 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Wed, 26 Nov 2008 17:14:27 +0000 Subject: [PATCH] * Allow the maximum number of concurrent builds per platform to be configured. --- src/Hydra/lib/Hydra/Schema.pm | 4 ++-- src/Hydra/lib/Hydra/Schema/Buildinputs.pm | 4 ++-- src/Hydra/lib/Hydra/Schema/Buildproducts.pm | 4 ++-- src/Hydra/lib/Hydra/Schema/Buildresultinfo.pm | 4 ++-- src/Hydra/lib/Hydra/Schema/Builds.pm | 4 ++-- .../lib/Hydra/Schema/Buildschedulinginfo.pm | 4 ++-- src/Hydra/lib/Hydra/Schema/Buildsteps.pm | 4 ++-- .../lib/Hydra/Schema/Cachedpathinputs.pm | 4 ++-- .../Hydra/Schema/Cachedsubversioninputs.pm | 4 ++-- src/Hydra/lib/Hydra/Schema/Jobsetinputalts.pm | 4 ++-- src/Hydra/lib/Hydra/Schema/Jobsetinputs.pm | 4 ++-- src/Hydra/lib/Hydra/Schema/Jobsets.pm | 4 ++-- src/Hydra/lib/Hydra/Schema/Projects.pm | 4 ++-- src/Hydra/lib/Hydra/Schema/Systemtypes.pm | 24 +++++++++++++++++++ src/Hydra/programs/Runner.pl | 9 +++---- src/hydra.sql | 6 +++++ 16 files changed, 61 insertions(+), 30 deletions(-) create mode 100644 src/Hydra/lib/Hydra/Schema/Systemtypes.pm diff --git a/src/Hydra/lib/Hydra/Schema.pm b/src/Hydra/lib/Hydra/Schema.pm index f345f22a..a0569e34 100644 --- a/src/Hydra/lib/Hydra/Schema.pm +++ b/src/Hydra/lib/Hydra/Schema.pm @@ -8,8 +8,8 @@ use base 'DBIx::Class::Schema'; __PACKAGE__->load_classes; -# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-26 14:37:07 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:E0tjF/wARKGxMml3bYcLFQ +# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-26 18:03:19 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:Pcp+OvDPqTvMftKcbkPkjA # You can replace this text with custom content, and it will be preserved on regeneration diff --git a/src/Hydra/lib/Hydra/Schema/Buildinputs.pm b/src/Hydra/lib/Hydra/Schema/Buildinputs.pm index 2fe7fa50..3ebcc9b0 100644 --- a/src/Hydra/lib/Hydra/Schema/Buildinputs.pm +++ b/src/Hydra/lib/Hydra/Schema/Buildinputs.pm @@ -36,8 +36,8 @@ __PACKAGE__->belongs_to("build", "Hydra::Schema::Builds", { id => "build" }); __PACKAGE__->belongs_to("dependency", "Hydra::Schema::Builds", { id => "dependency" }); -# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-26 14:37:07 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:ACPzMIxSYRMXkv8LGwR6lA +# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-26 18:03:19 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:LXmRVGbyhgP5UGYK5ekbog # You can replace this text with custom content, and it will be preserved on regeneration diff --git a/src/Hydra/lib/Hydra/Schema/Buildproducts.pm b/src/Hydra/lib/Hydra/Schema/Buildproducts.pm index 84149a38..3e886224 100644 --- a/src/Hydra/lib/Hydra/Schema/Buildproducts.pm +++ b/src/Hydra/lib/Hydra/Schema/Buildproducts.pm @@ -33,8 +33,8 @@ __PACKAGE__->set_primary_key("build", "productnr"); __PACKAGE__->belongs_to("build", "Hydra::Schema::Builds", { id => "build" }); -# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-26 14:37:07 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:lREoFKnRpeyIMd+9AxbYuQ +# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-26 18:03:19 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:ai10FDZA/INuvAMu+1mvWw # You can replace this text with custom content, and it will be preserved on regeneration diff --git a/src/Hydra/lib/Hydra/Schema/Buildresultinfo.pm b/src/Hydra/lib/Hydra/Schema/Buildresultinfo.pm index 0ee60082..31c3d364 100644 --- a/src/Hydra/lib/Hydra/Schema/Buildresultinfo.pm +++ b/src/Hydra/lib/Hydra/Schema/Buildresultinfo.pm @@ -29,8 +29,8 @@ __PACKAGE__->set_primary_key("id"); __PACKAGE__->belongs_to("id", "Hydra::Schema::Builds", { id => "id" }); -# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-26 14:37:07 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:6wMlFDXyRr0ElqsdFbRc3g +# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-26 18:03:19 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:KLmCZNoPd+vFmAj7XNtLMQ # You can replace this text with custom content, and it will be preserved on regeneration diff --git a/src/Hydra/lib/Hydra/Schema/Builds.pm b/src/Hydra/lib/Hydra/Schema/Builds.pm index dfc08545..1ff5e317 100644 --- a/src/Hydra/lib/Hydra/Schema/Builds.pm +++ b/src/Hydra/lib/Hydra/Schema/Builds.pm @@ -70,8 +70,8 @@ __PACKAGE__->has_many( ); -# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-26 14:37:07 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:cX3mAlsEB9POMvmCcoWn6A +# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-26 18:03:19 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:hm/IA7ESnKT9gls0lw1Daw __PACKAGE__->has_many(dependents => 'Hydra::Schema::Buildinputs', 'dependency'); diff --git a/src/Hydra/lib/Hydra/Schema/Buildschedulinginfo.pm b/src/Hydra/lib/Hydra/Schema/Buildschedulinginfo.pm index 8f329601..bc6f8a39 100644 --- a/src/Hydra/lib/Hydra/Schema/Buildschedulinginfo.pm +++ b/src/Hydra/lib/Hydra/Schema/Buildschedulinginfo.pm @@ -23,8 +23,8 @@ __PACKAGE__->set_primary_key("id"); __PACKAGE__->belongs_to("id", "Hydra::Schema::Builds", { id => "id" }); -# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-26 14:37:07 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:O6bwijQ4R6Ke9QjYjsuUsA +# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-26 18:03:19 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:d/8LOVy+FfKFEo7iFbP3Gw # You can replace this text with custom content, and it will be preserved on regeneration diff --git a/src/Hydra/lib/Hydra/Schema/Buildsteps.pm b/src/Hydra/lib/Hydra/Schema/Buildsteps.pm index bd6e430b..67cb704c 100644 --- a/src/Hydra/lib/Hydra/Schema/Buildsteps.pm +++ b/src/Hydra/lib/Hydra/Schema/Buildsteps.pm @@ -35,8 +35,8 @@ __PACKAGE__->set_primary_key("id", "stepnr"); __PACKAGE__->belongs_to("id", "Hydra::Schema::Builds", { id => "id" }); -# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-26 14:37:07 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:7vdFywkKYZeLSow8AijaUA +# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-26 18:03:19 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:a/DM38J4HR2LBDTeXvt4uA # You can replace this text with custom content, and it will be preserved on regeneration diff --git a/src/Hydra/lib/Hydra/Schema/Cachedpathinputs.pm b/src/Hydra/lib/Hydra/Schema/Cachedpathinputs.pm index 5b848c0c..f8f630f8 100644 --- a/src/Hydra/lib/Hydra/Schema/Cachedpathinputs.pm +++ b/src/Hydra/lib/Hydra/Schema/Cachedpathinputs.pm @@ -22,8 +22,8 @@ __PACKAGE__->add_columns( __PACKAGE__->set_primary_key("srcpath", "sha256hash"); -# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-26 14:37:07 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:dPQ2YTZIUdMRwBbiu1qwUw +# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-26 18:03:19 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:Pnefs6s7Y0i3YRE+BoWdDg # You can replace this text with custom content, and it will be preserved on regeneration diff --git a/src/Hydra/lib/Hydra/Schema/Cachedsubversioninputs.pm b/src/Hydra/lib/Hydra/Schema/Cachedsubversioninputs.pm index 3bda4b38..db92f0b3 100644 --- a/src/Hydra/lib/Hydra/Schema/Cachedsubversioninputs.pm +++ b/src/Hydra/lib/Hydra/Schema/Cachedsubversioninputs.pm @@ -20,8 +20,8 @@ __PACKAGE__->add_columns( __PACKAGE__->set_primary_key("uri", "revision"); -# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-26 14:37:07 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:EVNo1URK0XJTQo+KXHlmpA +# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-26 18:03:19 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:gmw8LSLTRV00vCYDKiuZOw # You can replace this text with custom content, and it will be preserved on regeneration diff --git a/src/Hydra/lib/Hydra/Schema/Jobsetinputalts.pm b/src/Hydra/lib/Hydra/Schema/Jobsetinputalts.pm index 595428a9..3f50ad5e 100644 --- a/src/Hydra/lib/Hydra/Schema/Jobsetinputalts.pm +++ b/src/Hydra/lib/Hydra/Schema/Jobsetinputalts.pm @@ -33,8 +33,8 @@ __PACKAGE__->belongs_to( ); -# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-26 14:37:07 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:eM2dwDI3lL5EHwUA5m2pDg +# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-26 18:03:19 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:R26KAvuQZHKAyG/hEaB6Gw # You can replace this text with custom content, and it will be preserved on regeneration diff --git a/src/Hydra/lib/Hydra/Schema/Jobsetinputs.pm b/src/Hydra/lib/Hydra/Schema/Jobsetinputs.pm index 887d7eba..ccf2dc7c 100644 --- a/src/Hydra/lib/Hydra/Schema/Jobsetinputs.pm +++ b/src/Hydra/lib/Hydra/Schema/Jobsetinputs.pm @@ -43,8 +43,8 @@ __PACKAGE__->has_many( ); -# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-26 14:37:07 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:poDHcgoqxtQf8HN7AbpnOA +# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-26 18:03:19 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:quDswVe6ApUm4cYVVijAEw # You can replace this text with custom content, and it will be preserved on regeneration diff --git a/src/Hydra/lib/Hydra/Schema/Jobsets.pm b/src/Hydra/lib/Hydra/Schema/Jobsets.pm index a398a35a..b19c8578 100644 --- a/src/Hydra/lib/Hydra/Schema/Jobsets.pm +++ b/src/Hydra/lib/Hydra/Schema/Jobsets.pm @@ -50,8 +50,8 @@ __PACKAGE__->has_many( ); -# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-26 14:37:07 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:BJwh19m9KHKZUMAiQ6fPAw +# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-26 18:03:19 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:nDI28mE5gmZwDozOG/0fnw # You can replace this text with custom content, and it will be preserved on regeneration diff --git a/src/Hydra/lib/Hydra/Schema/Projects.pm b/src/Hydra/lib/Hydra/Schema/Projects.pm index 9ef871e7..5001393e 100644 --- a/src/Hydra/lib/Hydra/Schema/Projects.pm +++ b/src/Hydra/lib/Hydra/Schema/Projects.pm @@ -30,8 +30,8 @@ __PACKAGE__->has_many( ); -# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-26 14:37:07 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:v/jpJlVZg1k8PDLJyZhpSA +# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-26 18:03:19 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:SKZ/imJK1fjPbBEXde23Og # You can replace this text with custom content, and it will be preserved on regeneration diff --git a/src/Hydra/lib/Hydra/Schema/Systemtypes.pm b/src/Hydra/lib/Hydra/Schema/Systemtypes.pm new file mode 100644 index 00000000..858dc770 --- /dev/null +++ b/src/Hydra/lib/Hydra/Schema/Systemtypes.pm @@ -0,0 +1,24 @@ +package Hydra::Schema::Systemtypes; + +use strict; +use warnings; + +use base 'DBIx::Class'; + +__PACKAGE__->load_components("Core"); +__PACKAGE__->table("SystemTypes"); +__PACKAGE__->add_columns( + "system", + { data_type => "text", is_nullable => 0, size => undef }, + "maxconcurrent", + { data_type => "integer", is_nullable => 0, size => undef }, +); +__PACKAGE__->set_primary_key("system"); + + +# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-26 18:03:19 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:/NVhmxcHU6YWCXDX9sO8mA + + +# You can replace this text with custom content, and it will be preserved on regeneration +1; diff --git a/src/Hydra/programs/Runner.pl b/src/Hydra/programs/Runner.pl index 344ccdc9..002e6940 100644 --- a/src/Hydra/programs/Runner.pl +++ b/src/Hydra/programs/Runner.pl @@ -51,8 +51,9 @@ sub checkJobs { {join => 'schedulingInfo'})->count; # How many extra builds can we start? - my $maxActive = 2; - my $extraAllowed = $maxActive - $nrActive; + (my $systemTypeInfo) = $db->resultset('Systemtypes')->search({system => $system->system}); + my $maxConcurrent = defined $systemTypeInfo ? $systemTypeInfo->maxconcurrent : 2; + my $extraAllowed = $maxConcurrent - $nrActive; $extraAllowed = 0 if $extraAllowed < 0; # Select the highest-priority builds to start. @@ -62,7 +63,7 @@ sub checkJobs { rows => $extraAllowed }); print "system type `", $system->system, - "': $nrActive active, $maxActive allowed, ", + "': $nrActive active, $maxConcurrent allowed, ", "starting ", scalar(@jobs), " builds\n"; foreach my $job (@jobs) { @@ -82,7 +83,7 @@ sub checkJobs { # outside the transaction in case it aborts or something. foreach my $job (@jobsStarted) { my $id = $job->id; - print "starting job $id\n"; + print "starting job $id (", $job->project->name, ":", $job->attrname, ") on ", $job->system, "\n"; eval { my $child = fork(); die unless defined $child; diff --git a/src/hydra.sql b/src/hydra.sql index c68bbae9..04cc1864 100644 --- a/src/hydra.sql +++ b/src/hydra.sql @@ -255,3 +255,9 @@ create table CachedSubversionInputs ( storePath text not null, primary key (uri, revision) ); + + +create table SystemTypes ( + system text primary key not null, + maxConcurrent integer not null default 2 +);