* Don't start more builds concurrently than allowed for each system
[?]
Nov 26, 2008, 2:20 PM
NREF6YOAKK2QVNXGU7WHD3KSDNCCIAQW3GQ5KOANEXFBWDPUHWXACDependencies
- [2]
JK2QWPH6 - [3]
TULPZ62Y* Perform builds in parallel. - [4]
L2E6EVE2* Merged the Build and Job tables. - [5]
WHAFVCEI - [6]
7YBYT2LQ
Change contents
- replacement in src/Hydra/programs/Runner.pl at line 33
my $job;my @jobsStarted; - replacement in src/Hydra/programs/Runner.pl at line 37
my @jobs = $db->resultset('Builds')->search(# Get the system types for the runnable builds.my @systemTypes = $db->resultset('Builds')->search( - replacement in src/Hydra/programs/Runner.pl at line 41
{join => 'schedulingInfo', order_by => ["priority", "timestamp"]});{join => 'schedulingInfo', select => [{distinct => 'system'}], as => ['system']}); - replacement in src/Hydra/programs/Runner.pl at line 43
print "# of available jobs: ", scalar(@jobs), "\n";# For each system type, select up to the maximum number of# concurrent build for that system type. Choose the highest# priority builds first, then the oldest builds.foreach my $system (@systemTypes) {# How many builds are already currently executing for this# system type?my $nrActive = $db->resultset('Builds')->search({finished => 0, busy => 1, system => $system->system},{join => 'schedulingInfo'})->count; - replacement in src/Hydra/programs/Runner.pl at line 53[3.8666]→[3.8666:8727](∅→∅),[3.8727]→[3.1583:1665](∅→∅),[3.1665]→[3.11854:11943](∅→∅),[3.8727]→[3.11854:11943](∅→∅),[3.11943]→[3.1666:1719](∅→∅),[3.1719]→[3.11943:11985](∅→∅),[3.11943]→[3.11943:11985](∅→∅),[3.11985]→[2.287:329](∅→∅),[2.329]→[3.8810:8820](∅→∅),[3.11985]→[3.8810:8820](∅→∅),[3.8810]→[3.8810:8820](∅→∅)
if (scalar @jobs > 0) {$job = $jobs[0];$logfile = getcwd . "/logs/" . $job->id;unlink $logfile;$job->schedulingInfo->busy(1);$job->schedulingInfo->locker($$);$job->schedulingInfo->logfile($logfile);$job->schedulingInfo->update;$job->buildsteps->delete_all;}# How many extra builds can we start?my $maxActive = 2;my $extraAllowed = $maxActive - $nrActive;$extraAllowed = 0 if $extraAllowed < 0;# Select the highest-priority builds to start.my @jobs = $extraAllowed == 0 ? () : $db->resultset('Builds')->search({ finished => 0, busy => 0, system => $system->system },{ join => 'schedulingInfo', order_by => ["priority DESC", "timestamp"],rows => $extraAllowed });print "system type `", $system->system,"': $nrActive active, $maxActive allowed, ","starting ", scalar(@jobs), " builds\n"; - edit in src/Hydra/programs/Runner.pl at line 68
foreach my $job (@jobs) {$logfile = getcwd . "/logs/" . $job->id;unlink $logfile;$job->schedulingInfo->busy(1);$job->schedulingInfo->locker($$);$job->schedulingInfo->logfile($logfile);$job->schedulingInfo->update;$job->buildsteps->delete_all;push @jobsStarted, $job;}} - replacement in src/Hydra/programs/Runner.pl at line 81
# Start the job. We need to do this outside the transaction in# case it aborts or something.if (defined $job) {# Actually start the builds we just selected. We need to do this# outside the transaction in case it aborts or something.foreach my $job (@jobsStarted) { - replacement in src/Hydra/programs/Runner.pl at line 96
_exit(1);POSIX::_exit(1);