All new accounts created on Gitlab now require administrator approval. If you invite any collaborators, please let Flux staff know so they can approve the accounts.

Commit 6391ffb4 authored by Leigh B. Stoller's avatar Leigh B. Stoller

Clean up the exit codes; use die consistently so that we return -1

on fatal errors, and error codes >= 1 for assign errors. The batch
system depends on these error codes to determine if a batch needs
to be punted from the system.
parent e76b278c
......@@ -68,7 +68,7 @@ getopts('v',\%opt);
sub usage {
print "Usage: $0 [-v] pid eid\n";
print " -v enables verbose output\n";
return 1;
exit(-1);
}
my $verbose = 0;
......@@ -77,7 +77,7 @@ if ($opt{v}) {
}
if (@ARGV != 2) {
exit &usage();
usage();
}
($pid,$eid) = @ARGV;
......@@ -185,7 +185,14 @@ $result =
"where pid='$pid' and eid='$eid'");
while (($vname,$ips,$type,$fixed,$isvirt) = $result->fetchrow_array) {
if (! defined($fixed)) {$fixed = "";}
if (! defined($fixed)) {$fixed = "";}
#
# if its a vtype, no entry in node_types. vtypes break virtual nodes.
# Need to look inside the vtype and make sure no mixing of vnodes and
# physnodes. Later ...
#
if (! defined($isvirt)) {$isvirt = 0;}
printdb " $vname $type $ips $fixed $isvirt\n";
# We need to check the names to make sure they won't clash with
# our internal delay node names.
......@@ -381,8 +388,8 @@ while (($name,$weight,$types) = $result->fetchrow_array) {
# Open the TOP file
$topfile = "$eid.top";
open(TOPFILE,"> $topfile") || do {
print STDERR "$0: *** Could not open $topfile.\n";
exit(1);
die("*** $0:\n".
" Could not open $topfile.\n");
};
# Print out vtypes
......@@ -556,6 +563,7 @@ while (1) {
print "Assign Run $currentrun\n";
# Violation counts
$unassigned = -1;
$linkusers = -1;
$bandwidth = -1;
$desires = -1;
......@@ -646,8 +654,8 @@ while (1) {
last SWITCH1;
};
/^direct$/ && do {
print STDERR "$0: *** Unsupported link type: direct.\n";
exit(1);
die("*** $0:\n".
" Unsupported link type: direct.\n");
};
print "Found garbage: $line\n";
}
......@@ -670,6 +678,8 @@ while (1) {
$linkusers = $1;
} elsif (/bandwidth: (\d+)$/) {
$bandwidth = $1;
} elsif (/unassigned: (\d+)$/) {
$unassigned = $1;
} elsif (/desires: (\d+)$/) {
$desires = $1;
}
......@@ -711,6 +721,9 @@ while (1) {
if ($desires > 0) {
$exitcode += 16;
}
if ($unassigned > 0) {
$exitcode += 32;
}
print "$0: *** Reached run limit. Giving up.\n";
exit($exitcode);
}
......@@ -1049,8 +1062,8 @@ foreach $pair (@nodepairs) {
#
elsif (! ($osid = TBOSID($pid, $osname)) &&
! ($osid = TBOSID(TB_OPSPID, $osname))) {
print STDERR "$0: *** Invalid OS $osname in project $pid!\n";
exit(1);
die("*** $0:\n".
" Invalid OS $osname in project $pid!\n");
}
DBQueryFatal("UPDATE nodes set def_boot_osid=\"$osid\"," .
" def_boot_cmd_line='$cmdline'," .
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment