$got_shareix= $candrow->{shareix};
$ok=1; last;
}
+ if (!$resq->rows) {
+ return (-1,undef);
+ }
return ($ok, { Allocate => $allocate,
Shareix => $got_shareix,
Info => "$resname ($restype/$resname/$got_shareix)"
if (!$ok) {
logm("nothing available for $res, sorry");
$allok=0;
+ } elsif ($ok < 0) {
+ die "*** no candidates for $res! ***\n";
} else {
logm("processed $res (shareix=$got->{Shareix})");
push @got, $got;
logm("best at $planned->{Start} is ".showposs(\@reqlist));
die unless $planned;
- my $allok=0;
+ my $worstok=0;
if ($mayalloc && !$planned->{Start}) {
- $allok=1;
+ $worstok=1;
alloc_prep();
foreach my $req (@reqlist) {
my ($ok, $got) = alloc_1res($req->{Ident});
+ $worstok = $ok if $ok < $worstok;
if (!$ok) {
logm("failed to allocate $req->{Ident}!");
- $allok=0;
+ } elsif ($ok < 0) {
+ logm("*** no candidates for $req->{Ident}! ***");
} else {
$req->{GotShareix}= $got->{Shareix};
push @got, $got;
}
}
- if ($allok) {
+ if ($worstok > 0) {
logm("allocated, notifying...");
- } else {
+ } elsif ($worstok < 0) {
+ logm("*** problems, maybe missing resources? ***");
+ return (0, undef);
+ } else {
logm("booking...");
}
Start => $planned->{Start},
End => $planned->{Start} + $duration,
};
- if ($allok) {
+ if ($worstok > 0) {
$book->{Allocated}= {
Task => $tid,
Shareix => $req->{GotShareix},
push @bookings, $book;
}
- return ($allok, { Bookings => \@bookings });
+ return ($worstok, { Bookings => \@bookings });
});
loggot(@got);
}