forked from lix-project/hydra
* Randomly permute the order in which builds are added. This is
mainly to prevent all those Nixpkgs builds named "kde*" from building at the same time. Since they all have the same slow dependencies (qt, kdelibs) this tends to block the buildfarm.
This commit is contained in:
parent
c48ec3d340
commit
109cc35edf
|
@ -364,6 +364,17 @@ sub inputsToArgs {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub permute {
|
||||||
|
my @list = @_;
|
||||||
|
print scalar @list, "\n";
|
||||||
|
for (my $n = scalar @list - 1; $n > 0; $n--) {
|
||||||
|
my $k = int(rand($n + 1)); # 0 <= $k <= $n
|
||||||
|
@list[$n, $k] = @list[$k, $n];
|
||||||
|
}
|
||||||
|
return @list;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
sub checkJobset {
|
sub checkJobset {
|
||||||
my ($project, $jobset) = @_;
|
my ($project, $jobset) = @_;
|
||||||
my $inputInfo = {};
|
my $inputInfo = {};
|
||||||
|
@ -392,7 +403,7 @@ sub checkJobset {
|
||||||
or die "cannot parse XML output";
|
or die "cannot parse XML output";
|
||||||
|
|
||||||
# Schedule each successfully evaluated job.
|
# Schedule each successfully evaluated job.
|
||||||
foreach my $job (@{$jobs->{job}}) {
|
foreach my $job (permute @{$jobs->{job}}) {
|
||||||
next if $job->{jobName} eq "";
|
next if $job->{jobName} eq "";
|
||||||
print "considering job " . $job->{jobName} . "\n";
|
print "considering job " . $job->{jobName} . "\n";
|
||||||
checkJob($project, $jobset, $inputInfo, $nixExprInput, $job);
|
checkJob($project, $jobset, $inputInfo, $nixExprInput, $job);
|
||||||
|
|
Loading…
Reference in a new issue