Changeset 43048 for branches/eam_branches/ipp-pstamp-20260421/pstamp/scripts/pstamp_queue_requests.pl
- Timestamp:
- Jun 1, 2026, 4:53:16 PM (7 weeks ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-pstamp-20260421/pstamp/scripts/pstamp_queue_requests.pl
r42981 r43048 11 11 12 12 use Getopt::Long qw( GetOptions ); 13 use Scalar::Util qw(looks_like_number); 13 14 14 15 use Sys::Hostname; … … 77 78 $command .= " -dbserver $dbserver" if $dbserver; 78 79 79 my ( $success, $error_ code, $full_buf, $stdout_buf, $stderr_buf ) =80 my ( $success, $error_msg, $full_buf, $stdout_buf, $stderr_buf ) = 80 81 run(command => $command, verbose => $verbose); 82 my $error_code = &parse_error_message ($success, $error_msg, $command); 81 83 unless ($success) { 82 my $rc = $error_code >> 8;84 my $rc = $error_code; 83 85 die("Unable to perform pstamptool -datastore: $rc"); 84 86 } … … 121 123 $command .= " --timeout $timeout"; 122 124 123 my ( $success, $error_ code, $full_buf, $stdout_buf, $stderr_buf ) =125 my ( $success, $error_msg, $full_buf, $stdout_buf, $stderr_buf ) = 124 126 run(command => $command, verbose => $verbose); 127 my $error_code = &parse_error_message ($success, $error_msg, $command); 125 128 unless ($success) { 126 129 # dsproductls exit status is the http error code - 300 127 my $exit_status = $error_code >> 8;130 my $exit_status = $error_code; 128 131 129 132 # don't die on "common faults" … … 167 170 { 168 171 my $command = "$dsfilesetls --uri $uri"; 169 my ( $success, $error_ code, $full_buf, $stdout_buf, $stderr_buf ) =172 my ( $success, $error_msg, $full_buf, $stdout_buf, $stderr_buf ) = 170 173 run(command => $command, verbose => $verbose); 174 my $error_code = &parse_error_message ($success, $error_msg, $command); 171 175 unless ($success) { 172 176 # we don't want to die here. We need to set lastFileset … … 197 201 $command .= " -dbserver $dbserver" if $dbserver; 198 202 199 my ( $success, $error_ code, $full_buf, $stdout_buf, $stderr_buf ) =203 my ( $success, $error_msg, $full_buf, $stdout_buf, $stderr_buf ) = 200 204 run(command => $command, verbose => $verbose); 205 my $error_code = &parse_error_message ($success, $error_msg, $command); 201 206 202 207 unless ($success) { … … 208 213 209 214 { 210 ## now update the last_fileset column in pstampDataStore 211 my $command = "$pstamptool -ds_id $ds_id -moddatastore -set_last_fileset $lastFileset"; 212 $command .= " -dbname $dbname" if $dbname; 213 $command .= " -dbserver $dbserver" if $dbserver; 214 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 215 run(command => $command, verbose => $verbose); 216 unless ($success) { 217 die("Unable to perform pstamptool -moddatastore: $error_code"); 218 } 215 ## now update the last_fileset column in pstampDataStore 216 my $command = "$pstamptool -ds_id $ds_id -moddatastore -set_last_fileset $lastFileset"; 217 $command .= " -dbname $dbname" if $dbname; 218 $command .= " -dbserver $dbserver" if $dbserver; 219 my ( $success, $error_msg, $full_buf, $stdout_buf, $stderr_buf ) = 220 run(command => $command, verbose => $verbose); 221 my $error_code = &parse_error_message ($success, $error_msg, $command); 222 unless ($success) { 223 die("Unable to perform pstamptool -moddatastore: $error_code"); 224 } 219 225 } 220 226 last if ($numFilesets >= $limit); … … 232 238 $command .= " -dbname $dbname" if $dbname; 233 239 $command .= " -dbserver $dbserver" if $dbserver; 234 my ( $success, $error_ code, $full_buf, $stdout_buf, $stderr_buf ) =240 my ( $success, $error_msg, $full_buf, $stdout_buf, $stderr_buf ) = 235 241 run(command => $command, verbose => $verbose); 242 my $error_code = &parse_error_message ($success, $error_msg, $command); 236 243 unless ($success) { 237 244 die("Unable to perform pstamptool -moddatastore: $error_code"); 238 245 } 239 246 } 247 248 # if the program exited normally, the exit value is returned 249 # if the program exited with a signal (abort, crash, etc), PS_EXIT_PROG_ERROR (4) is returned 250 # if the program failed to run, -PS_EXIT_PROG_ERROR (-4) is returned 251 sub parse_error_message { 252 my $success = shift; 253 my $error_msg = shift; 254 my $command = shift; 255 256 if ($success) { return 0; } 257 258 print "raw error_msg: $error_msg\n"; 259 print "full command: $command\n"; 260 261 if (&looks_like_number($error_msg)) { return (($error_msg >> 8) or ($PS_EXIT_PROG_ERROR)); } 262 263 # which of these match? 264 my ($error_code) = $error_msg =~ m/exited with value (\d+)/; 265 if (defined $error_code) { return $error_code; } 266 267 ($error_code) = $error_msg =~ m/died with signal (\d+)/; 268 # if (defined $error_code) { return (128 + $error_code); } 269 if (defined $error_code) { return ($PS_EXIT_PROG_ERROR); } 270 271 # probably failed to execute: 272 return (-1*$PS_EXIT_PROG_ERROR); 273 }
Note:
See TracChangeset
for help on using the changeset viewer.
