- Timestamp:
- Jun 12, 2026, 2:47:49 PM (7 weeks ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-pstamp-20260421/pstamp/scripts/pstamp_finish.pl
r43048 r43052 12 12 use Time::Local; 13 13 use Sys::Hostname; 14 use IPC::Cmd 0.36 qw( can_run run);14 use IPC::Cmd 0.36 qw( can_run ); 15 15 use File::Temp qw( tempfile ); 16 16 use File::Copy; 17 17 use File::Basename qw(dirname); 18 use Scalar::Util qw(looks_like_number);19 18 20 19 use PS::IPP::Metadata::Config; … … 22 21 use PS::IPP::Metadata::List qw( parse_md_list ); 23 22 24 use PS::IPP::Config qw( :standard );23 use PS::IPP::Config qw( :standard ps_run ); 25 24 use PS::IPP::PStamp::RequestFile qw( :standard ); 26 25 use PS::IPP::PStamp::Job qw( :standard ); … … 138 137 $command .= " -dbname $dbname" if $dbname; 139 138 $command .= " -dbserver $dbserver" if $dbserver; 140 my ( $success, $error_msg, $full_buf, $stdout_buf, $stderr_buf ) = run(command => $command, verbose => $verbose); 141 my $error_code = &parse_error_message ($success, $error_msg, $command); 139 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = ps_run($command, $verbose); 142 140 unless ($success) { 143 die("Unable to perform $command error code: $error_code"); 141 my $rc = $error_code >> 8; 142 die("Unable to perform $command error code: $rc ($error_code)"); 144 143 } 145 144 my $output = join "", @$stdout_buf; … … 261 260 { 262 261 my $command = "$pstamp_results --input $table_def_name --output $outdir/results.fits"; 263 my ( $success, $error_msg, $full_buf, $stdout_buf, $stderr_buf ) = run(command => $command, verbose => $verbose); 264 my $error_code = &parse_error_message ($success, $error_msg, $command); 262 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = ps_run(command => $command, verbose => $verbose); 265 263 unless ($success) { 266 264 print STDERR "Unable to perform $command error code: $error_code\n"; 267 $request_fault = $error_code ;265 $request_fault = $error_code >> 8; 268 266 } else { 269 267 # dump a textual representation 270 268 my $command = "$pstampdump $outdir/results.fits > $outdir/results.mdc"; 271 269 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 272 run(command => $command, verbose => $verbose);270 ps_run(command => $command, verbose => $verbose); 273 271 unless ($success) { 274 $request_fault = $error_code;272 $request_fault = $error_code >> 8; 275 273 my_die("Unable to perform $command error code: $error_code", $req_id, $request_fault); 276 274 } … … 287 285 288 286 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 289 run(command => $command, verbose => $verbose);287 ps_run(command => $command, verbose => $verbose); 290 288 unless ($success) { 291 $request_fault = $error_code;289 $request_fault = $error_code >> 8; 292 290 my_die("Unable to perform $command error code: $error_code\n", $req_id, $request_fault); 293 291 } … … 299 297 $command .= " -dbserver $dbserver" if $dbserver; 300 298 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 301 run(command => $command, verbose => $verbose);299 ps_run(command => $command, verbose => $verbose); 302 300 unless ($success) { 303 301 die("Unable to perform $command error code: $error_code"); … … 319 317 320 318 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 321 run(command => $command, verbose => $verbose);319 ps_run(command => $command, verbose => $verbose); 322 320 unless ($success) { 323 321 die("Unable to perform $command error code: $error_code"); … … 435 433 # run the tool and parse the output 436 434 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 437 run(command => $command, verbose => $verbose);435 ps_run(command => $command, verbose => $verbose); 438 436 unless ($success) { 439 437 # not sure if we should die here … … 506 504 return 40587.0 + ($ticks/86400.); 507 505 } 508 509 # if the program exited normally, the exit value is returned510 # if the program exited with a signal (abort, crash, etc), PS_EXIT_PROG_ERROR (4) is returned511 # if the program failed to run, -PS_EXIT_PROG_ERROR (-4) is returned512 sub parse_error_message {513 my $success = shift;514 my $error_msg = shift;515 my $command = shift;516 517 if ($success) { return 0; }518 519 print "raw error_msg: $error_msg\n";520 print "full command: $command\n";521 522 if (&looks_like_number($error_msg)) { return (($error_msg >> 8) or ($PS_EXIT_PROG_ERROR)); }523 524 # which of these match?525 my ($error_code) = $error_msg =~ m/exited with value (\d+)/;526 if (defined $error_code) { return $error_code; }527 528 ($error_code) = $error_msg =~ m/died with signal (\d+)/;529 # if (defined $error_code) { return (128 + $error_code); }530 if (defined $error_code) { return ($PS_EXIT_PROG_ERROR); }531 532 # probably failed to execute:533 return (-1*$PS_EXIT_PROG_ERROR);534 }
Note:
See TracChangeset
for help on using the changeset viewer.
