- 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_job_run.pl
r43048 r43052 15 15 use File::Copy; 16 16 use File::Temp qw(tempfile tempdir); 17 use Scalar::Util qw(looks_like_number);18 17 19 18 use Digest::MD5::File qw( file_md5_hex ); 20 19 use PS::IPP::PStamp::RequestFile qw( :standard ); 21 20 use PS::IPP::PStamp::Job qw( :standard ); 22 use IPC::Cmd 0.36 qw( can_run run);21 use IPC::Cmd 0.36 qw( can_run ); 23 22 use POSIX; 24 23 … … 27 26 use PS::IPP::Metadata::List qw( parse_md_list ); 28 27 29 use PS::IPP::Config qw( :standard );28 use PS::IPP::Config qw( :standard ps_run ); 30 29 31 30 my ($job_id, $redirect_output, $outputBase, $rownum, $jobType, $options); … … 222 221 my $command = "$psgetcalibinfo --cam_id $cam_id --output $calibfile --dbname $params->{imagedb}"; 223 222 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 224 run(command => $command, verbose => $verbose);223 ps_run(command => $command, verbose => $verbose); 225 224 226 225 my $exitStatus; … … 254 253 255 254 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 256 run(command => $command, verbose => $verbose);255 ps_run(command => $command, verbose => $verbose); 257 256 258 257 if (WIFEXITED($error_code)) { … … 289 288 290 289 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 291 run(command => $command, verbose => $verbose);290 ps_run(command => $command, verbose => $verbose); 292 291 293 292 if (WIFEXITED($error_code)) { … … 311 310 my $command = "$fpack_gzip $tmpName > $numName"; 312 311 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 313 run(command => $command, verbose => $verbose);312 ps_run(command => $command, verbose => $verbose); 314 313 315 314 if (WIFEXITED($error_code)) { … … 330 329 my $command = "$fpack_gzip $tmpBase.fits > $outputBase.exp.fits"; 331 330 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 332 run(command => $command, verbose => $verbose);331 ps_run(command => $command, verbose => $verbose); 333 332 334 333 if (WIFEXITED($error_code)) { … … 412 411 $command .= " --verbose" if $verbose; 413 412 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 414 run(command => $command, verbose => $verbose);413 ps_run(command => $command, verbose => $verbose); 415 414 416 415 if ($success) { … … 437 436 $command .= " --save-temps" if $save_temps; 438 437 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 439 run(command => $command, verbose => $verbose);438 ps_run(command => $command, verbose => $verbose); 440 439 441 440 # Although dqueryparse can potentially force more updates (and more jobs), it should still return success. … … 461 460 if (!$no_update) { 462 461 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 463 run(command => $command, verbose => $verbose);462 ps_run(command => $command, verbose => $verbose); 464 463 unless ($success) { 465 464 die("Unable to perform $command: $error_code"); … … 652 651 653 652 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 654 run(command => $command, verbose => $verbose);653 ps_run(command => $command, verbose => $verbose); 655 654 unless ($success) { 656 655 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); … … 826 825 my $command = "$stack_bkg_mk_mdc --stack_id $stack_id --camera $camera --dbname $imagedb > $mdcfile"; 827 826 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 828 run(command => $command, verbose => $verbose);827 ps_run(command => $command, verbose => $verbose); 829 828 unless ($success) { 830 829 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); … … 842 841 $command .= " -mask $input_mask" if $input_mask; 843 842 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 844 run(command => $command, verbose => $very_verbose);843 ps_run(command => $command, verbose => $very_verbose); 845 844 unless ($success) { 846 845 # we turned off verbosity because ppBackgroundStack emits too much output … … 867 866 868 867 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 869 run(command => $command, verbose => $verbose);868 ps_run(command => $command, verbose => $verbose); 870 869 unless ($success) { 871 870 print STDERR join "", @$stderr_buf; … … 947 946 exit $exit_code; 948 947 } 949 950 951 # if the program exited normally, the exit value is returned952 # if the program exited with a signal (abort, crash, etc), PS_EXIT_PROG_ERROR (4) is returned953 # if the program failed to run, -PS_EXIT_PROG_ERROR (-4) is returned954 sub parse_error_message {955 my $success = shift;956 my $error_msg = shift;957 my $command = shift;958 959 if ($success) { return 0; }960 961 print "raw error_msg: $error_msg\n";962 print "full command: $command\n";963 964 if (&looks_like_number($error_msg)) { return (($error_msg >> 8) or ($PS_EXIT_PROG_ERROR)); }965 966 # which of these match?967 my ($error_code) = $error_msg =~ m/exited with value (\d+)/;968 if (defined $error_code) { return $error_code; }969 970 ($error_code) = $error_msg =~ m/died with signal (\d+)/;971 # if (defined $error_code) { return (128 + $error_code); }972 if (defined $error_code) { return ($PS_EXIT_PROG_ERROR); }973 974 # probably failed to execute:975 return (-1*$PS_EXIT_PROG_ERROR);976 }
Note:
See TracChangeset
for help on using the changeset viewer.
