forked from lix-project/hydra
* Allow the maximum number of concurrent builds per platform to be
configured.
This commit is contained in:
parent
5f7142eb82
commit
b7e03351cb
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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');
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
24
src/Hydra/lib/Hydra/Schema/Systemtypes.pm
Normal file
24
src/Hydra/lib/Hydra/Schema/Systemtypes.pm
Normal file
|
@ -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;
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
);
|
||||
|
|
Loading…
Reference in a new issue