Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make allocpool check the allocations file #3839

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions scripts/mkcloudhost/allocpool
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ use Time::HiRes qw(sleep);
use Fcntl qw(:DEFAULT :flock);

my $pooldir="$ENV{HOME}/pool";
my $allocationsfile="$ENV{HOME}/allocations";
my $allocname="tmpqueuesched.pid";
# Take the oldest directory
my @dirs= sort { (stat("$a/$allocname"))[9] <=>
Expand All @@ -19,6 +20,19 @@ sleep(rand(2)); # reduce chance of collisions with make -j
# lock+select testdir
my $found=0;
foreach my $d (@dirs) {
# check that allocations isn't out of sync with pool
open my $fha, $allocationsfile or die "Error: cant read $allocationsfile";
my $allocationfound=0;
my $n=$d;
$n=~ s/$pooldir\///;
while(my $line=<$fha>) {
if($line =~ /^[a-z]*$n jenkins$/) {
$allocationfound=1;
last;
}
}
if(!$allocationfound) {die "Error: cant find in $allocationsfile: $n jenkins"}
close($fha);
# use own allocation lock protocol
my $a="$d/$allocname";
sysopen my $fh, $a, O_RDWR|O_CREAT or die "cant create $a";
Expand Down