Changeset 43052 for branches/eam_branches/ipp-pstamp-20260421/pstamp/scripts/pstamp_queue_requests.pl
- Timestamp:
- Jun 12, 2026, 2:47:49 PM (5 weeks ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-pstamp-20260421/pstamp/scripts/pstamp_queue_requests.pl
r43048 r43052 11 11 12 12 use Getopt::Long qw( GetOptions ); 13 use Scalar::Util qw(looks_like_number);14 13 15 14 use Sys::Hostname; … … 35 34 } 36 35 37 use IPC::Cmd 0.36 qw( can_run run);36 use IPC::Cmd 0.36 qw( can_run ); 38 37 39 38 use PS::IPP::Metadata::Config; … … 51 50 metadataLookupBool 52 51 caturi 52 ps_run 53 53 ); 54 54 … … 78 78 $command .= " -dbserver $dbserver" if $dbserver; 79 79 80 my ( $success, $error_msg, $full_buf, $stdout_buf, $stderr_buf ) = 81 run(command => $command, verbose => $verbose); 82 my $error_code = &parse_error_message ($success, $error_msg, $command); 80 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 81 ps_run(command => $command, verbose => $verbose); 83 82 unless ($success) { 84 my $rc = $error_code;83 my $rc = ($error_code >> 8); 85 84 die("Unable to perform pstamptool -datastore: $rc"); 86 85 } … … 123 122 $command .= " --timeout $timeout"; 124 123 125 my ( $success, $error_msg, $full_buf, $stdout_buf, $stderr_buf ) = 126 run(command => $command, verbose => $verbose); 127 my $error_code = &parse_error_message ($success, $error_msg, $command); 124 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 125 ps_run(command => $command, verbose => $verbose); 128 126 unless ($success) { 129 127 # dsproductls exit status is the http error code - 300 130 my $exit_status = $error_code;128 my $exit_status = ($error_code >> 8); 131 129 132 130 # don't die on "common faults" … … 170 168 { 171 169 my $command = "$dsfilesetls --uri $uri"; 172 my ( $success, $error_msg, $full_buf, $stdout_buf, $stderr_buf ) = 173 run(command => $command, verbose => $verbose); 174 my $error_code = &parse_error_message ($success, $error_msg, $command); 170 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 171 ps_run(command => $command, verbose => $verbose); 175 172 unless ($success) { 176 173 # we don't want to die here. We need to set lastFileset … … 201 198 $command .= " -dbserver $dbserver" if $dbserver; 202 199 203 my ( $success, $error_msg, $full_buf, $stdout_buf, $stderr_buf ) = 204 run(command => $command, verbose => $verbose); 205 my $error_code = &parse_error_message ($success, $error_msg, $command); 200 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 201 ps_run(command => $command, verbose => $verbose); 206 202 207 203 unless ($success) { … … 217 213 $command .= " -dbname $dbname" if $dbname; 218 214 $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); 215 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 216 ps_run(command => $command, verbose => $verbose); 222 217 unless ($success) { 223 218 die("Unable to perform pstamptool -moddatastore: $error_code"); … … 238 233 $command .= " -dbname $dbname" if $dbname; 239 234 $command .= " -dbserver $dbserver" if $dbserver; 240 my ( $success, $error_ msg, $full_buf, $stdout_buf, $stderr_buf ) =235 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 241 236 run(command => $command, verbose => $verbose); 242 my $error_code = &parse_error_message ($success, $error_msg, $command);243 237 unless ($success) { 244 238 die("Unable to perform pstamptool -moddatastore: $error_code"); 245 239 } 246 240 } 247 248 # if the program exited normally, the exit value is returned249 # if the program exited with a signal (abort, crash, etc), PS_EXIT_PROG_ERROR (4) is returned250 # if the program failed to run, -PS_EXIT_PROG_ERROR (-4) is returned251 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.
