Changeset 43052
- Timestamp:
- Jun 12, 2026, 2:47:49 PM (5 weeks ago)
- Location:
- branches/eam_branches/ipp-pstamp-20260421/pstamp/scripts
- Files:
-
- 25 edited
-
detect_query_read (modified) (3 diffs)
-
detectability_respond.pl (modified) (6 diffs)
-
dquery_finish.pl (modified) (5 diffs)
-
dquery_job_run.pl (modified) (5 diffs)
-
dqueryparse.pl (modified) (11 diffs)
-
psgetcalibinfo (modified) (3 diffs)
-
psmkreq (modified) (3 diffs)
-
pstamp_checkdependent.pl (modified) (16 diffs)
-
pstamp_cleanup.pl (modified) (8 diffs)
-
pstamp_dorequest.pl (modified) (5 diffs)
-
pstamp_finish.pl (modified) (9 diffs)
-
pstamp_get_image_job.pl (modified) (4 diffs)
-
pstamp_insert_request.pl (modified) (4 diffs)
-
pstamp_job_run.pl (modified) (15 diffs)
-
pstamp_listjobs.pl (modified) (3 diffs)
-
pstamp_parser_run.pl (modified) (9 diffs)
-
pstamp_queue_cleanup.pl (modified) (3 diffs)
-
pstamp_queue_requests.pl (modified) (9 diffs)
-
pstamp_queue_update_cleanup.pl (modified) (4 diffs)
-
pstamp_revert_request.pl (modified) (5 diffs)
-
pstamp_save_server_status.pl (modified) (3 diffs)
-
pstamp_server_status (modified) (3 diffs)
-
pstamp_webrequest.pl (modified) (5 diffs)
-
pstampparse.pl (modified) (13 diffs)
-
request_finish.pl (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-pstamp-20260421/pstamp/scripts/detect_query_read
r41440 r43052 20 20 use Math::Trig; 21 21 use Data::Dumper; 22 use IPC::Cmd 0.36 qw( can_run run ); 22 use IPC::Cmd 0.36 qw( can_run ); 23 use PS::IPP::Config qw( :standard ps_run ); 23 24 24 25 use constant EXTNAME => 'MOPS_DETECTABILITY_QUERY'; # Extension name for table … … 195 196 my $cmd = "$regtool -processedexp -dbname $dbname -exp_name $colData{FPA_ID}[$i]"; 196 197 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 197 run(command => $cmd, verbose => 0);198 ps_run(command => $cmd, verbose => 0); 198 199 unless ($success) { 199 200 # This is a problem, because I'm not sure how we handle a failure to read something. … … 267 268 } 268 269 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 269 run(command => $cmd, verbose => 1);270 ps_run(command => $cmd, verbose => 1); 270 271 unless ($success) { 271 272 # This is a problem, because I'm not sure how we handle a failure to read something. -
branches/eam_branches/ipp-pstamp-20260421/pstamp/scripts/detectability_respond.pl
r33283 r43052 13 13 use File::Basename; 14 14 use File::Copy; 15 use IPC::Cmd 0.36 qw( can_run run);15 use IPC::Cmd 0.36 qw( can_run ); 16 16 use Getopt::Long qw( GetOptions ); 17 17 use Pod::Usage qw( pod2usage ); … … 20 20 use PS::IPP::PStamp::RequestFile qw( :standard ); 21 21 use PS::IPP::PStamp::Job qw( :standard ); 22 use PS::IPP::Config qw( :standard );22 use PS::IPP::Config qw( :standard ps_run ); 23 23 use PS::IPP::Metadata::List qw( parse_md_list ); 24 24 … … 108 108 my $dqr_command = "$detect_query_read --dbname $imagedb --input $request_file"; 109 109 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 110 run(command => $dqr_command, verbose => $verbose);110 ps_run(command => $dqr_command, verbose => $verbose); 111 111 unless ($success) { 112 112 # This is a problem, because I'm not sure how we handle a failure to read something. … … 433 433 my $command = "ppCoord -astrom $catalog -radec $coordname"; 434 434 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 435 run(command => $command, verbose => $verbose);435 ps_run(command => $command, verbose => $verbose); 436 436 unless ($success) { 437 437 my_die("Unable to perform $command. Error_code: $error_code", … … 473 473 474 474 ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 475 run(command => $psphot_cmd, verbose => $verbose);475 ps_run(command => $psphot_cmd, verbose => $verbose); 476 476 unless ($success) { 477 477 $query{$fpa_id}{PROC_ERROR}[$index] = $PSTAMP_SYSTEM_ERROR; … … 828 828 829 829 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 830 run(command => $command, verbose => $verbose);830 ps_run(command => $command, verbose => $verbose); 831 831 unless ($success) { 832 832 my $rc = $error_code >> 8; -
branches/eam_branches/ipp-pstamp-20260421/pstamp/scripts/dquery_finish.pl
r42981 r43052 10 10 11 11 use Sys::Hostname; 12 use IPC::Cmd 0.36 qw( can_run run);12 use IPC::Cmd 0.36 qw( can_run ); 13 13 use File::Temp qw( tempfile ); 14 14 use File::Copy; … … 20 20 use PS::IPP::Metadata::List qw( parse_md_list ); 21 21 22 use PS::IPP::Config qw( :standard );22 use PS::IPP::Config qw( :standard ps_run ); 23 23 24 24 my ( $req_id, $req_name, $req_file, $product, $outdir, $dbname, $dbserver, $verbose, $save_temps ); … … 95 95 $command .= " -dbserver $dbserver" if $dbserver; 96 96 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 97 run(command => $command, verbose => $verbose);97 ps_run(command => $command, verbose => $verbose); 98 98 unless ($success) { 99 99 die("Unable to perform $command error code: $error_code"); … … 160 160 161 161 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 162 run(command => $command, verbose => $verbose);162 ps_run(command => $command, verbose => $verbose); 163 163 unless ($success) { 164 164 $request_fault = $error_code >> 8; … … 388 388 $command .= " -dbserver $dbserver" if $dbserver; 389 389 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 390 run(command => $command, verbose => $verbose);390 ps_run(command => $command, verbose => $verbose); 391 391 unless ($success) { 392 392 die("Unable to perform $command error code: $error_code"); -
branches/eam_branches/ipp-pstamp-20260421/pstamp/scripts/dquery_job_run.pl
r41584 r43052 13 13 use File::Basename; 14 14 use File::Copy; 15 use IPC::Cmd 0.36 qw( can_run run);15 use IPC::Cmd 0.36 qw( can_run ); 16 16 use Getopt::Long qw( GetOptions ); 17 17 use Pod::Usage qw( pod2usage ); … … 20 20 use PS::IPP::PStamp::RequestFile qw( :standard ); 21 21 use PS::IPP::PStamp::Job qw( :standard ); 22 use PS::IPP::Config qw( :standard );22 use PS::IPP::Config qw( :standard ps_run ); 23 23 use PS::IPP::Metadata::List qw( parse_md_list ); 24 24 … … 120 120 my $command = "ppCoord -astrom $catalog -radec $coordname"; 121 121 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 122 run(command => $command, verbose => $verbose);122 ps_run(command => $command, verbose => $verbose); 123 123 ## MEH need to adjust error_code to rc 124 124 unless ($success) { … … 162 162 163 163 ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 164 run(command => $psphot_cmd, verbose => $verbose);164 ps_run(command => $psphot_cmd, verbose => $verbose); 165 165 unless ($success) { 166 166 # $params->{PROC_ERROR} = $PSTAMP_SYSTEM_ERROR; … … 339 339 340 340 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 341 run(command => $command, verbose => $verbose);341 ps_run(command => $command, verbose => $verbose); 342 342 unless ($success) { 343 343 my $rc = $error_code >> 8; -
branches/eam_branches/ipp-pstamp-20260421/pstamp/scripts/dqueryparse.pl
r42042 r43052 13 13 use File::Basename; 14 14 use File::Copy; 15 use IPC::Cmd 0.36 qw( can_run run);15 use IPC::Cmd 0.36 qw( can_run ); 16 16 use Getopt::Long qw( GetOptions ); 17 17 use Pod::Usage qw( pod2usage ); … … 21 21 use PS::IPP::PStamp::RequestFile qw( :standard ); 22 22 use PS::IPP::PStamp::Job qw( :standard ); 23 use PS::IPP::Config qw( :standard );23 use PS::IPP::Config qw( :standard ps_run ); 24 24 use PS::IPP::Metadata::List qw( parse_md_list ); 25 25 … … 88 88 my $command = "echo $request_file | $fields -x 0 EXTNAME EXTVER QUERY_ID"; 89 89 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 90 run(command => $command, verbose => $verbose);90 ps_run(command => $command, verbose => $verbose); 91 91 92 92 $fields_output = join "", @$stdout_buf; … … 105 105 # set verbose to false so that error message about request not found doesn't appear in parse_error.txt 106 106 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 107 run(command => $command, verbose => 0);107 ps_run(command => $command, verbose => 0); 108 108 if ($success) { 109 109 # -listreq succeeded duplicate request name … … 112 112 unless ($no_update) { 113 113 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 114 run(command => $command, verbose => $verbose);114 ps_run(command => $command, verbose => $verbose); 115 115 if (!$success) { 116 116 my_die("$command failed", $PS_EXIT_UNKNOWN_ERROR); … … 126 126 unless ($no_update) { 127 127 ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 128 run(command => $command, verbose => $verbose);128 ps_run(command => $command, verbose => $verbose); 129 129 unless ($success) { 130 130 my_die("$command failed", $PS_EXIT_UNKNOWN_ERROR); … … 151 151 my $dqr_command = "$detect_query_read --dbname $imagedb --input $request_file"; 152 152 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 153 run(command => $dqr_command, verbose => $verbose);153 ps_run(command => $dqr_command, verbose => $verbose); 154 154 unless ($success) { 155 155 # This is a problem, because I'm not sure how we handle a failure to read something. … … 489 489 unless ($no_update) { 490 490 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 491 run(command => $command, verbose => $verbose);491 ps_run(command => $command, verbose => $verbose); 492 492 if ($success) { 493 493 my $job_id = join "", @$stdout_buf; … … 513 513 unless ($no_update) { 514 514 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 515 run(command => $command, verbose => $verbose);515 ps_run(command => $command, verbose => $verbose); 516 516 if ($success) { 517 517 my $job_id = join "", @$stdout_buf; … … 534 534 unless ($no_update) { 535 535 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 536 run(command => $command, verbose => $verbose);536 ps_run(command => $command, verbose => $verbose); 537 537 unless ($success) { 538 538 my_die("$command failed",$PS_EXIT_UNKNOWN_ERROR); … … 564 564 if (!$no_update) { 565 565 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 566 run(command => $command, verbose => $verbose);566 ps_run(command => $command, verbose => $verbose); 567 567 unless ($success) { 568 568 my_die("$command failed", $PS_EXIT_UNKNOWN_ERROR); -
branches/eam_branches/ipp-pstamp-20260421/pstamp/scripts/psgetcalibinfo
r42983 r43052 10 10 use Carp; 11 11 12 use IPC::Cmd 0.36 qw( can_run run);12 use IPC::Cmd 0.36 qw( can_run ); 13 13 #use File::Temp qw( tempfile ); 14 14 #use File::Copy; … … 19 19 use PS::IPP::Metadata::List qw( parse_md_list ); 20 20 21 use PS::IPP::Config qw( :standard );21 use PS::IPP::Config qw( :standard ps_run ); 22 22 #use PS::IPP::PStamp::RequestFile qw( :standard ); 23 23 #use PS::IPP::PStamp::Job qw( :standard ); … … 55 55 $command .= " -dbname $dbname" if $dbname; 56 56 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 57 run(command => $command, verbose => $verbose);57 ps_run(command => $command, verbose => $verbose); 58 58 unless ($success) { 59 59 die("Unable to perform $command error code: $error_code"); -
branches/eam_branches/ipp-pstamp-20260421/pstamp/scripts/psmkreq
r43048 r43052 12 12 use Getopt::Long qw( GetOptions ) ; # :config auto_help auto_version gnu_getopt ); 13 13 use Pod::Usage qw( pod2usage ); 14 use PS::IPP::Config qw( :standard );14 use PS::IPP::Config qw( :standard ps_run ); 15 15 use PS::IPP::PStamp::RequestFile qw( :standard ); 16 16 use PS::IPP::PStamp::Job qw( :standard ); 17 17 use File::Temp qw(tempfile); 18 18 use File::Basename qw(basename); 19 use Scalar::Util qw(looks_like_number); 20 use IPC::Cmd 0.36 qw( can_run run ); 19 use IPC::Cmd 0.36 qw( can_run ); 21 20 use Carp; 22 21 use POSIX; … … 296 295 my $command = "$pstamp_request_file --input $table_def_name --req_name $req_name"; 297 296 $command .= " --output $output" if $output; 298 my ( $success, $error_msg, $full_buf, $stdout_buf, $stderr_buf ) = 299 run(command => $command, verbose => $verbose); 300 my $error_code = &parse_error_message ($success, $error_msg, $command); 297 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 298 ps_run(command => $command, verbose => $verbose); 301 299 unless ($success) { 302 300 print STDERR @$stderr_buf; 303 exit $error_code ;301 exit $error_code >>8; 304 302 } 305 303 } … … 450 448 } 451 449 452 # if the program exited normally, the exit value is returned453 # if the program exited with a signal (abort, crash, etc), PS_EXIT_PROG_ERROR (4) is returned454 # if the program failed to run, -PS_EXIT_PROG_ERROR (-4) is returned455 sub parse_error_message {456 my $success = shift;457 my $error_msg = shift;458 my $command = shift;459 460 if ($success) { return 0; }461 462 print "raw error_msg: $error_msg\n";463 print "full command: $command\n";464 465 if (&looks_like_number($error_msg)) { return (($error_msg >> 8) or ($PS_EXIT_PROG_ERROR)); }466 467 # which of these match?468 my ($error_code) = $error_msg =~ m/exited with value (\d+)/;469 if (defined $error_code) { return $error_code; }470 471 ($error_code) = $error_msg =~ m/died with signal (\d+)/;472 # if (defined $error_code) { return (128 + $error_code); }473 if (defined $error_code) { return ($PS_EXIT_PROG_ERROR); }474 475 # probably failed to execute:476 return (-1*$PS_EXIT_PROG_ERROR);477 }478 -
branches/eam_branches/ipp-pstamp-20260421/pstamp/scripts/pstamp_checkdependent.pl
r42981 r43052 15 15 use Carp; 16 16 use POSIX; 17 use IPC::Cmd 0.36 qw( can_run run);17 use IPC::Cmd 0.36 qw( can_run ); 18 18 use PS::IPP::Metadata::List qw( parse_md_list ); 19 use PS::IPP::Config qw( :standard );19 use PS::IPP::Config qw( :standard ps_run ); 20 20 use PS::IPP::PStamp::RequestFile qw( :standard ); 21 21 use Carp; … … 156 156 if (!$no_update) { 157 157 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 158 run(command => $command, verbose => $verbose);158 ps_run(command => $command, verbose => $verbose); 159 159 unless ($success) { 160 160 my_die("failed to set pstampDependent.state to 'full' dep_id: $dep_id", … … 312 312 if (!$no_update) { 313 313 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 314 run(command => $command, verbose => $verbose);314 ps_run(command => $command, verbose => $verbose); 315 315 unless ($success) { 316 316 my_die("failed to change ${stage}Run $stage_id $component from goto_cleaned to update", $PS_EXIT_UNKNOWN_ERROR); … … 343 343 if (!$no_update) { 344 344 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 345 run(command => $command, verbose => $verbose);345 ps_run(command => $command, verbose => $verbose); 346 346 unless ($success) { 347 347 my_die("failed to queue ${stage}Run $stage_id $component for update", $PS_EXIT_UNKNOWN_ERROR); … … 360 360 if (!$no_update) { 361 361 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 362 run(command => $command, verbose => $verbose);362 ps_run(command => $command, verbose => $verbose); 363 363 unless ($success) { 364 364 my_die("failed to change ${stage}Run $stage_id $component from goto_cleaned to update", $PS_EXIT_UNKNOWN_ERROR); … … 453 453 if (!$no_update) { 454 454 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 455 run(command => $command, verbose => $verbose);455 ps_run(command => $command, verbose => $verbose); 456 456 unless ($success) { 457 457 my_die("failed to change state of ${stage}Run $stage_id from goto_cleaned to update", $PS_EXIT_UNKNOWN_ERROR); … … 525 525 if (!$no_update) { 526 526 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 527 run(command => $command, verbose => $verbose);527 ps_run(command => $command, verbose => $verbose); 528 528 unless ($success) { 529 529 my_die("failed to queue ${stage}Run $stage_id $component for update", $PS_EXIT_UNKNOWN_ERROR); … … 539 539 if (!$no_update) { 540 540 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 541 run(command => $command, verbose => $verbose);541 ps_run(command => $command, verbose => $verbose); 542 542 unless ($success) { 543 543 my_die("failed to change state of ${stage}Run $stage_id to update", $PS_EXIT_UNKNOWN_ERROR); … … 582 582 if (!$no_update) { 583 583 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 584 run(command => $command, verbose => $verbose);584 ps_run(command => $command, verbose => $verbose); 585 585 unless ($success) { 586 586 my_die("failed to queue ${stage}Run $stage_id $component for update", $PS_EXIT_UNKNOWN_ERROR); … … 724 724 if (!$no_update) { 725 725 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 726 run(command => $command, verbose => $verbose);726 ps_run(command => $command, verbose => $verbose); 727 727 unless ($success) { 728 728 my_die("failed to queue ${stage}Run $stage_id $component for update", $PS_EXIT_UNKNOWN_ERROR); … … 737 737 if (!$no_update) { 738 738 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 739 run(command => $command, verbose => $verbose);739 ps_run(command => $command, verbose => $verbose); 740 740 unless ($success) { 741 741 my_die("failed to queue ${stage}Run $stage_id $component for update", $PS_EXIT_UNKNOWN_ERROR); … … 765 765 # run the command and parse the output 766 766 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 767 run(command => $command, verbose => $verbose);767 ps_run(command => $command, verbose => $verbose); 768 768 unless ($success) { 769 769 print STDERR @$stderr_buf if !$verbose; … … 904 904 if (!$no_update) { 905 905 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 906 run(command => $command, verbose => $verbose);906 ps_run(command => $command, verbose => $verbose); 907 907 unless ($success) { 908 908 my_die("failed to set destreaked component to 'update' for ${stage}Run $stage_id $c", … … 936 936 if (!$no_update) { 937 937 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 938 run(command => $command, verbose => $verbose);938 ps_run(command => $command, verbose => $verbose); 939 939 unless ($success) { 940 940 my_die("failed to set pstampJob.fault for dep_id: $dep_id", … … 970 970 if (!$no_update) { 971 971 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 972 run(command => $command, verbose => $verbose);972 ps_run(command => $command, verbose => $verbose); 973 973 unless ($success) { 974 974 carp "$cmd failed"; … … 988 988 if (!$no_update) { 989 989 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 990 run(command => $command, verbose => $verbose);990 ps_run(command => $command, verbose => $verbose); 991 991 unless ($success) { 992 992 carp "$cmd failed"; -
branches/eam_branches/ipp-pstamp-20260421/pstamp/scripts/pstamp_cleanup.pl
r42981 r43052 16 16 use POSIX qw( strftime ); 17 17 use Carp; 18 use IPC::Cmd 0.36 qw( can_run run);18 use IPC::Cmd 0.36 qw( can_run ); 19 19 20 20 use PS::IPP::Metadata::Config; … … 22 22 use PS::IPP::Metadata::List qw( parse_md_list ); 23 23 24 use PS::IPP::Config qw( :standard );24 use PS::IPP::Config qw( :standard ps_run ); 25 25 use PS::IPP::PStamp::Job qw( :standard ); 26 26 … … 91 91 92 92 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 93 run(command => $command, verbose => $verbose);93 ps_run(command => $command, verbose => $verbose); 94 94 unless ($success) { 95 95 my_die("Unable to perform $command error code: $error_code", $req_id, $PS_EXIT_UNKNOWN_ERROR); … … 102 102 $command .= " -dbserver $dbserver" if $dbserver; 103 103 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 104 run(command => $command, verbose => $verbose);104 ps_run(command => $command, verbose => $verbose); 105 105 unless ($success) { 106 106 die("Unable to perform $command error code: $error_code"); … … 136 136 my $command = "find $pstamp_workdir -maxdepth 2 -type d -name $req_id"; 137 137 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 138 run(command => $command, verbose => $verbose);138 ps_run(command => $command, verbose => $verbose); 139 139 unless ($success) { 140 140 my $rc = $error_code >> 8; … … 161 161 unless ($no_update) { 162 162 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 163 run(command => $command, verbose => $verbose);163 ps_run(command => $command, verbose => $verbose); 164 164 unless ($success) { 165 165 die("Unable to perform $command error code: $error_code"); … … 192 192 unless ($no_update) { 193 193 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 194 run(command => $command, verbose => $verbose);194 ps_run(command => $command, verbose => $verbose); 195 195 unless ($success) { 196 196 if (-e $dir) { … … 219 219 unless ($no_update) { 220 220 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 221 run(command => $command, verbose => $verbose);221 ps_run(command => $command, verbose => $verbose); 222 222 unless ($success) { 223 223 die("Unable to perform $command error code: $error_code"); -
branches/eam_branches/ipp-pstamp-20260421/pstamp/scripts/pstamp_dorequest.pl
r42981 r43052 28 28 } 29 29 30 use IPC::Cmd 0.36 qw( can_run run);30 use IPC::Cmd 0.36 qw( can_run ); 31 31 32 32 use PS::IPP::Metadata::Config; … … 44 44 metadataLookupBool 45 45 caturi 46 ps_run 46 47 ); 47 48 … … 63 64 my $command = "$pstamptool -pendingjob"; 64 65 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 65 run(command => $command, verbose => $verbosity);66 ps_run(command => $command, verbose => $verbosity); 66 67 unless ($success) { 67 68 die("Unable to perform pstamptool -pendingreq: $error_code"); … … 94 95 my $command = "$ppstamp_run $job->{job_id}"; 95 96 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 96 run(command => $command, verbose => $verbosity);97 ps_run(command => $command, verbose => $verbosity); 97 98 unless ($success) { 98 99 die("Unable to perform $command: $error_code"); … … 108 109 my $command = "$pstamptool -updatereq -req_id $request_id -set_state stop"; 109 110 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 110 run(command => $command, verbose => $verbosity);111 ps_run(command => $command, verbose => $verbosity); 111 112 unless ($success) { 112 113 die("Unable to perform pstamptool -updatereq: $error_code"); -
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 } -
branches/eam_branches/ipp-pstamp-20260421/pstamp/scripts/pstamp_get_image_job.pl
r36048 r43052 16 16 use File::Basename; 17 17 use Digest::MD5::File qw( file_md5_hex ); 18 use IPC::Cmd 0.36 qw( can_run run);19 20 21 use PS::IPP::Config qw( :standard );18 use IPC::Cmd 0.36 qw( can_run ); 19 20 21 use PS::IPP::Config qw( :standard ps_run ); 22 22 23 23 my $product; … … 132 132 $command .= " --verbose" if $verbose; 133 133 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 134 run(command => $command, verbose => $verbose);134 ps_run(command => $command, verbose => $verbose); 135 135 unless ($success) { 136 136 my_die("Unable to perform $command: $error_code", $error_code >> 8); … … 174 174 my $command = "$pstamptool -deletefile -job_id $job_id"; 175 175 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 176 run(command => $command, verbose => $verbose);176 ps_run(command => $command, verbose => $verbose); 177 177 unless ($success) { 178 178 my_die("Unable to perform $command: $error_code", $error_code >> 8); … … 193 193 my $command = "$pstamptool -addfile -job_id $job_id -path $bundle_name"; 194 194 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 195 run(command => $command, verbose => $verbose);195 ps_run(command => $command, verbose => $verbose); 196 196 unless ($success) { 197 197 my_die("Unable to perform $command: $error_code", $error_code >> 8); -
branches/eam_branches/ipp-pstamp-20260421/pstamp/scripts/pstamp_insert_request.pl
r42981 r43052 33 33 if( !defined($tmp_req_file) or !defined($workdir) or !defined ($dbname) 34 34 or !defined($dbserver)); 35 use IPC::Cmd 0.36 qw( can_run run);35 use IPC::Cmd 0.36 qw( can_run ); 36 36 37 use PS::IPP::Config qw( :standard );37 use PS::IPP::Config qw( :standard ps_run ); 38 38 39 39 use Cwd; … … 60 60 my $command = "$fhead -x 0 $tmp_req_file"; 61 61 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 62 run(command => $command, verbose => $verbose);62 ps_run(command => $command, verbose => $verbose); 63 63 unless ($success) { 64 64 print STDERR @$stderr_buf; … … 147 147 $command .= " -label WEB.UP"; 148 148 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 149 run(command => $command, verbose => $verbose);149 ps_run(command => $command, verbose => $verbose); 150 150 unless ($success) { 151 151 my $errbuf = join "", @$stderr_buf; … … 172 172 $command .= " -dbserver $dbserver" if $dbserver; 173 173 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 174 run(command => $command, verbose => $verbose);174 ps_run(command => $command, verbose => $verbose); 175 175 unless ($success) { 176 176 my $status = $error_code >> 8; -
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 } -
branches/eam_branches/ipp-pstamp-20260421/pstamp/scripts/pstamp_listjobs.pl
r42981 r43052 36 36 } 37 37 38 use IPC::Cmd 0.36 qw( can_run run);38 use IPC::Cmd 0.36 qw( can_run ); 39 39 40 40 use PS::IPP::Metadata::Config; … … 52 52 metadataLookupBool 53 53 caturi 54 ps_run 54 55 ); 55 56 … … 72 73 $command .= " -dbserver $dbserver" if $dbserver; 73 74 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 74 run(command => $command, verbose => $verbose);75 ps_run(command => $command, verbose => $verbose); 75 76 unless ($success) { 76 77 die("Unable to perform pstamptool -pendingreq: $error_code"); -
branches/eam_branches/ipp-pstamp-20260421/pstamp/scripts/pstamp_parser_run.pl
r43048 r43052 13 13 use Getopt::Long qw( GetOptions ); 14 14 use File::Basename qw( basename dirname); 15 use Scalar::Util qw(looks_like_number);16 15 use File::Copy; 17 16 use POSIX qw( strftime ); 18 17 use Carp; 19 use IPC::Cmd 0.36 qw( can_run run);18 use IPC::Cmd 0.36 qw( can_run ); 20 19 21 20 use PS::IPP::Metadata::Config; … … 23 22 use PS::IPP::Metadata::List qw( parse_md_list ); 24 23 25 use PS::IPP::Config qw( :standard );24 use PS::IPP::Config qw( :standard ps_run ); 26 25 use PS::IPP::PStamp::RequestFile qw( :standard ); 27 26 … … 129 128 # if the uri is an http uri download the file 130 129 my $command = "$dsget --uri $uri --filename $new_uri --timeout 120"; 131 my ( $success, $error_msg, $full_buf, $stdout_buf, $stderr_buf ) = 132 run(command => $command, verbose => $verbose); 133 my $error_code = &parse_error_message ($success, $error_msg, $command); 130 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 131 ps_run(command => $command, verbose => $verbose); 134 132 unless ($success) { 135 my_die("Unable to perform $command error code: $error_code", $req_id, $error_code );133 my_die("Unable to perform $command error code: $error_code", $req_id, $error_code >> 8); 136 134 } 137 135 } elsif ($uri ne $new_uri) { … … 206 204 $command .= " -dbname $dbname" if $dbname; 207 205 $command .= " -dbserver $dbserver" if $dbserver; 208 my ( $success, $error_ msg, $full_buf, $stdout_buf, $stderr_buf ) =206 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 209 207 run(command => $command, verbose => $verbose); 210 my $error_code = &parse_error_message ($success, $error_msg, $command);211 208 unless ($success) { 212 209 die("Unable to perform $command error code: $error_code"); … … 230 227 231 228 my $command = "$parse_cmd"; 232 my ( $success, $error_msg, $full_buf, $stdout_buf, $stderr_buf ) = 233 run(command => $command, verbose => $verbose); 234 my $error_code = &parse_error_message ($success, $error_msg, $command); 229 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 230 ps_run(command => $command, verbose => $verbose); 235 231 236 232 # save the contents of stderr (if any) to a file. This is relevant if … … 258 254 } 259 255 } else { 260 $fault = $error_code ;256 $fault = $error_code >> 8; 261 257 } 262 258 } … … 275 271 $command .= " -dbserver $dbserver" if $dbserver; 276 272 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 277 run(command => $command, verbose => $verbose);273 ps_run(command => $command, verbose => $verbose); 278 274 unless ($success) { 279 275 die("Unable to perform $command error code: $error_code"); … … 324 320 $command .= " -dbserver $dbserver" if $dbserver; 325 321 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 326 run(command => $command, verbose => $verbose);322 ps_run(command => $command, verbose => $verbose); 327 323 unless ($success) { 328 324 die("Unable to perform $command error code: $error_code"); … … 330 326 exit $fault; 331 327 } 332 333 # if the program exited normally, the exit value is returned334 # if the program exited with a signal (abort, crash, etc), PS_EXIT_PROG_ERROR (4) is returned335 # if the program failed to run, -PS_EXIT_PROG_ERROR (-4) is returned336 sub parse_error_message {337 my $success = shift;338 my $error_msg = shift;339 my $command = shift;340 341 if ($success) { return 0; }342 343 print "raw error_msg: $error_msg\n";344 print "full command: $command\n";345 346 if (&looks_like_number($error_msg)) { return (($error_msg >> 8) or ($PS_EXIT_PROG_ERROR)); }347 348 # which of these match?349 my ($error_code) = $error_msg =~ m/exited with value (\d+)/;350 if (defined $error_code) { return $error_code; }351 352 ($error_code) = $error_msg =~ m/died with signal (\d+)/;353 # if (defined $error_code) { return (128 + $error_code); }354 if (defined $error_code) { return ($PS_EXIT_PROG_ERROR); }355 356 # probably failed to execute:357 return (-1*$PS_EXIT_PROG_ERROR);358 }359 -
branches/eam_branches/ipp-pstamp-20260421/pstamp/scripts/pstamp_queue_cleanup.pl
r43048 r43052 6 6 use warnings; 7 7 8 use PS::IPP::Config 1.01 qw( :standard );9 use IPC::Cmd 0.36 qw( can_run run);8 use PS::IPP::Config 1.01 qw( :standard ps_run ); 9 use IPC::Cmd 0.36 qw( can_run ); 10 10 use Getopt::Long qw( GetOptions :config auto_help auto_version gnu_getopt ); 11 11 use Pod::Usage qw( pod2usage ); 12 use Scalar::Util qw(looks_like_number);13 12 14 13 my $verbose; … … 70 69 71 70 my $command = "$pstamptool -updatereq -set_state goto_cleaned -state stop -timestamp_end $timestamp_end"; 72 my ( $success, $error_msg, $full_buf, $stdout_buf, $stderr_buf ) = 73 run(command => $command, verbose => $verbose); 74 my $error_code = &parse_error_message ($success, $error_msg, $command); 71 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 72 ps_run(command => $command, verbose => $verbose); 75 73 unless ($success) { 76 $error_code = ( $error_codeor 1);74 $error_code = (($error_code >> 8) or 1); 77 75 warn("$command failed. exit status: $error_code"); 78 76 exit $error_code; … … 82 80 exit 0; 83 81 84 # if the program exited normally, the exit value is returned85 # if the program exited with a signal (abort, crash, etc), PS_EXIT_PROG_ERROR (4) is returned86 # if the program failed to run, -PS_EXIT_PROG_ERROR (-4) is returned87 sub parse_error_message {88 my $success = shift;89 my $error_msg = shift;90 my $command = shift;91 92 if ($success) { return 0; }93 94 print "raw error_msg: $error_msg\n";95 print "full command: $command\n";96 97 if (&looks_like_number($error_msg)) { return (($error_msg >> 8) or ($PS_EXIT_PROG_ERROR)); }98 99 # which of these match?100 my ($error_code) = $error_msg =~ m/exited with value (\d+)/;101 if (defined $error_code) { return $error_code; }102 103 ($error_code) = $error_msg =~ m/died with signal (\d+)/;104 # if (defined $error_code) { return (128 + $error_code); }105 if (defined $error_code) { return ($PS_EXIT_PROG_ERROR); }106 107 # probably failed to execute:108 return (-1*$PS_EXIT_PROG_ERROR);109 } -
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 } -
branches/eam_branches/ipp-pstamp-20260421/pstamp/scripts/pstamp_queue_update_cleanup.pl
r43048 r43052 6 6 use warnings; 7 7 8 use PS::IPP::Config 1.01 qw( :standard );9 use IPC::Cmd 0.36 qw( can_run run);8 use PS::IPP::Config 1.01 qw( :standard ps_run ); 9 use IPC::Cmd 0.36 qw( can_run ); 10 10 use Getopt::Long qw( GetOptions :config auto_help auto_version gnu_getopt ); 11 11 use Pod::Usage qw( pod2usage ); 12 use Scalar::Util qw(looks_like_number);13 12 14 13 my $verbose; … … 67 66 68 67 my $command = "$pstamptool -pendingdependent -includefaulted -simple"; 69 my ( $success, $error_msg, $full_buf, $stdout_buf, $stderr_buf ) = 70 run(command => $command, verbose => $very_verbose); 71 my $error_code = &parse_error_message ($success, $error_msg, $command); 68 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 69 ps_run(command => $command, verbose => $very_verbose); 72 70 unless ($success) { 73 $error_code = ( $error_codeor 1);71 $error_code = (($error_code >> 8) or 1); 74 72 warn("$command failed. exit status: $error_code"); 75 73 exit $error_code; … … 88 86 $command .= " -dbname $imagedb"; 89 87 90 my ( $success, $error_msg, $full_buf, $stdout_buf, $stderr_buf ) = 91 run(command => $command, verbose => $very_verbose); 92 my $error_code = &parse_error_message ($success, $error_msg, $command); 88 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 89 ps_run(command => $command, verbose => $very_verbose); 93 90 unless ($success) { 94 $error_code = ( $error_codeor 1);91 $error_code = (($error_code >> 8) or 1); 95 92 warn("$command failed. exit status: $error_code"); 96 93 exit $error_code; … … 101 98 exit 0; 102 99 103 # if the program exited normally, the exit value is returned104 # if the program exited with a signal (abort, crash, etc), PS_EXIT_PROG_ERROR (4) is returned105 # if the program failed to run, -PS_EXIT_PROG_ERROR (-4) is returned106 sub parse_error_message {107 my $success = shift;108 my $error_msg = shift;109 my $command = shift;110 111 if ($success) { return 0; }112 113 print "raw error_msg: $error_msg\n";114 print "full command: $command\n";115 116 if (&looks_like_number($error_msg)) { return (($error_msg >> 8) or ($PS_EXIT_PROG_ERROR)); }117 118 # which of these match?119 my ($error_code) = $error_msg =~ m/exited with value (\d+)/;120 if (defined $error_code) { return $error_code; }121 122 ($error_code) = $error_msg =~ m/died with signal (\d+)/;123 # if (defined $error_code) { return (128 + $error_code); }124 if (defined $error_code) { return ($PS_EXIT_PROG_ERROR); }125 126 # probably failed to execute:127 return (-1*$PS_EXIT_PROG_ERROR);128 } -
branches/eam_branches/ipp-pstamp-20260421/pstamp/scripts/pstamp_revert_request.pl
r42981 r43052 10 10 11 11 use Sys::Hostname; 12 use IPC::Cmd 0.36 qw( can_run run);12 use IPC::Cmd 0.36 qw( can_run ); 13 13 use File::Temp qw( tempfile ); 14 14 use File::Copy; … … 28 28 metadataLookupBool 29 29 caturi 30 ps_run 30 31 ); 31 32 … … 68 69 $command .= " -dbserver $dbserver" if $dbserver; 69 70 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 70 run(command => $command, verbose => $verbose);71 ps_run(command => $command, verbose => $verbose); 71 72 unless ($success) { 72 73 die("Unable to perform $command error code: $error_code"); … … 102 103 # $command .= " --dbname $dbname" if $dbname; 103 104 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 104 run(command => $command, verbose => $verbose);105 ps_run(command => $command, verbose => $verbose); 105 106 unless ($success) { 106 107 die "Unable to perform $command error code: $error_code"; … … 114 115 $command .= " -dbserver $dbserver" if $dbserver; 115 116 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 116 run(command => $command, verbose => $verbose);117 ps_run(command => $command, verbose => $verbose); 117 118 unless ($success) { 118 119 die("Unable to perform $command error code: $error_code"); -
branches/eam_branches/ipp-pstamp-20260421/pstamp/scripts/pstamp_save_server_status.pl
r43048 r43052 7 7 use warnings; 8 8 9 use PS::IPP::Config 1.01 qw( :standard );10 use IPC::Cmd 0.36 qw( can_run run);9 use PS::IPP::Config 1.01 qw( :standard ps_run ); 10 use IPC::Cmd 0.36 qw( can_run ); 11 11 use Getopt::Long qw( GetOptions :config auto_help auto_version gnu_getopt ); 12 12 use Pod::Usage qw( pod2usage ); 13 use Scalar::Util qw(looks_like_number);14 13 15 14 my $updatelink; … … 64 63 my $command = "pstamp_server_status --workdir $pstamp_workdir > $file"; 65 64 #my $command = "pstamp_server_status > $file"; 66 my ( $success, $error_msgo, $full_buf, $stdout_buf, $stderr_buf ) = 67 run(command => $command, verbose => $verbose); 68 my $error_code = &parse_error_message ($success, $error_msg, $command); 65 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 66 ps_run(command => $command, verbose => $verbose); 69 67 unless ($success) { 70 $error_code = ( $error_codeor 1);68 $error_code = (($error_code >> 8) or 1); 71 69 warn("$command failed. exit status: $error_code"); 72 70 exit $error_code; … … 82 80 83 81 exit 0; 84 85 # if the program exited normally, the exit value is returned86 # if the program exited with a signal (abort, crash, etc), PS_EXIT_PROG_ERROR (4) is returned87 # if the program failed to run, -PS_EXIT_PROG_ERROR (-4) is returned88 sub parse_error_message {89 my $success = shift;90 my $error_msg = shift;91 my $command = shift;92 93 if ($success) { return 0; }94 95 print "raw error_msg: $error_msg\n";96 print "full command: $command\n";97 98 if (&looks_like_number($error_msg)) { return (($error_msg >> 8) or ($PS_EXIT_PROG_ERROR)); }99 100 # which of these match?101 my ($error_code) = $error_msg =~ m/exited with value (\d+)/;102 if (defined $error_code) { return $error_code; }103 104 ($error_code) = $error_msg =~ m/died with signal (\d+)/;105 # if (defined $error_code) { return (128 + $error_code); }106 if (defined $error_code) { return ($PS_EXIT_PROG_ERROR); }107 108 # probably failed to execute:109 return (-1*$PS_EXIT_PROG_ERROR);110 } -
branches/eam_branches/ipp-pstamp-20260421/pstamp/scripts/pstamp_server_status
r43048 r43052 7 7 8 8 #use DBI; 9 use IPC::Cmd 0.36 qw( can_run run);9 use IPC::Cmd 0.36 qw( can_run ); 10 10 #use PS::IPP::Metadata::Config; 11 use PS::IPP::Config 1.01 qw( :standard );11 use PS::IPP::Config 1.01 qw( :standard ps_run ); 12 12 13 13 use Getopt::Long qw( GetOptions :config auto_help auto_version gnu_getopt ); 14 14 use Pod::Usage qw( pod2usage ); 15 use Scalar::Util qw(looks_like_number);16 15 17 16 my ($rundir, $workdir, $verbose, $save_temps); … … 71 70 my $serverRunning = 0; 72 71 my $command = "$pantasks_client < $pantasks_script"; 73 my ( $success, $error_msg, $full_buf, $stdout_buf, $stderr_buf ) = 74 run(command => $command, verbose => $verbose); 75 my $error_code = &parse_error_message ($success, $error_msg, $command); 72 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 73 ps_run(command => $command, verbose => $verbose); 76 74 if ($success) { 77 75 $serverRunning = 1; 78 76 } else { 79 $error_code = ( $error_codeor 1);77 $error_code = (($error_code >> 8) or 1); 80 78 if ($error_code == 12 || $error_code == 13) { 81 79 print "Postage Stamp Server is not running\n<br>"; … … 206 204 207 205 exit 0; 208 209 # if the program exited normally, the exit value is returned210 # if the program exited with a signal (abort, crash, etc), PS_EXIT_PROG_ERROR (4) is returned211 # if the program failed to run, -PS_EXIT_PROG_ERROR (-4) is returned212 sub parse_error_message {213 my $success = shift;214 my $error_msg = shift;215 my $command = shift;216 217 if ($success) { return 0; }218 219 print "raw error_msg: $error_msg\n";220 print "full command: $command\n";221 222 if (&looks_like_number($error_msg)) { return (($error_msg >> 8) or ($PS_EXIT_PROG_ERROR)); }223 224 # which of these match?225 my ($error_code) = $error_msg =~ m/exited with value (\d+)/;226 if (defined $error_code) { return $error_code; }227 228 ($error_code) = $error_msg =~ m/died with signal (\d+)/;229 # if (defined $error_code) { return (128 + $error_code); }230 if (defined $error_code) { return ($PS_EXIT_PROG_ERROR); }231 232 # probably failed to execute:233 return (-1*$PS_EXIT_PROG_ERROR);234 } -
branches/eam_branches/ipp-pstamp-20260421/pstamp/scripts/pstamp_webrequest.pl
r43048 r43052 46 46 47 47 48 use IPC::Cmd 0.36 qw( can_run run);48 use IPC::Cmd 0.36 qw( can_run ); 49 49 50 50 use PS::IPP::Config qw($PS_EXIT_SUCCESS … … 58 58 metadataLookupBool 59 59 caturi 60 ps_run 60 61 ); 61 62 … … 102 103 103 104 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 104 run(command => $command, verbose => $verbose);105 ps_run(command => $command, verbose => $verbose); 105 106 unless ($success) { 106 107 print STDERR @$stderr_buf; … … 120 121 $command .= " -dbserver $dbserver" if $dbserver; 121 122 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 122 run(command => $command, verbose => $verbose);123 ps_run(command => $command, verbose => $verbose); 123 124 unless ($success) { 124 125 print STDERR @$stderr_buf; … … 140 141 $command .= " -dbserver $dbserver" if $dbserver; 141 142 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 142 run(command => $command, verbose => $verbose);143 ps_run(command => $command, verbose => $verbose); 143 144 unless ($success) { 144 145 print STDERR @$stderr_buf; -
branches/eam_branches/ipp-pstamp-20260421/pstamp/scripts/pstampparse.pl
r43048 r43052 15 15 use File::Temp qw(tempfile); 16 16 use File::Basename qw(basename); 17 use Scalar::Util qw(looks_like_number);18 17 use Carp; 19 18 use POSIX; … … 67 66 } 68 67 69 use IPC::Cmd 0.36 qw( can_run run);68 use IPC::Cmd 0.36 qw( can_run ); 70 69 71 70 use PS::IPP::Metadata::Config; … … 73 72 use PS::IPP::Metadata::List qw( parse_md_list ); 74 73 75 use PS::IPP::Config qw( :standard );74 use PS::IPP::Config qw( :standard ps_run ); 76 75 my $ipprc = PS::IPP::Config->new(); # IPP Configuration 77 76 … … 127 126 { 128 127 my $command = "echo $request_file_name | $fields -x 0 EXTNAME EXTVER REQ_NAME ACTION EMAIL"; 129 my ( $success, $error_msg, $full_buf, $stdout_buf, $stderr_buf ) = 130 run(command => $command, verbose => $verbose); 131 my $error_code = &parse_error_message ($success, $error_msg, $command); 128 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 129 ps_run(command => $command, verbose => $verbose); 132 130 133 131 # note fields doesn't return zero when it succeeds. 132 # XXX EAM 2026.06.10 : the above note has not been true since 2007! 134 133 $fields_output = join "", @$stdout_buf; 135 134 } … … 186 185 my $command = "$pstamptool -listreq -name $req_name -not_req_id $req_id"; 187 186 # no verbose so that error message about request not found doesn't appear in parse_error.txt 188 my ( $success, $error_msg, $full_buf, $stdout_buf, $stderr_buf ) = 189 run(command => $command, verbose => 0); 190 my $error_code = &parse_error_message ($success, $error_msg, $command); 191 my $exitStatus = $error_code; 187 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 188 ps_run(command => $command, verbose => 0); 189 my $exitStatus = $error_code >> 8; 192 190 if ($success) { 193 191 # -listreq succeeded there is already a request in the database with this name … … 285 283 unless ($no_update) { 286 284 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 287 run(command => $command, verbose => $verbose);285 ps_run(command => $command, verbose => $verbose); 288 286 unless ($success) { 289 287 my_die("$command failed", $PS_EXIT_UNKNOWN_ERROR); … … 313 311 my $command = "$pstampdump $request_file_name"; 314 312 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 315 run(command => $command, verbose => $verbose);313 ps_run(command => $command, verbose => $verbose); 316 314 unless ($success) { 317 315 print STDERR @$stderr_buf; … … 394 392 my $command = "$pstamptool -updatereq -req_id $req_id -set_label $label"; 395 393 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 396 run(command => $command, verbose => $verbose);394 ps_run(command => $command, verbose => $verbose); 397 395 unless ($success) { 398 396 my_die("$command failed", $PS_EXIT_UNKNOWN_ERROR); … … 822 820 my $start_addjob = gettimeofday(); 823 821 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 824 run(command => $command, verbose => $verbose);822 ps_run(command => $command, verbose => $verbose); 825 823 unless ($success) { 826 824 print STDERR @$stderr_buf; … … 977 975 # mode eq "queue_job" 978 976 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 979 run(command => $command, verbose => $verbose);977 ps_run(command => $command, verbose => $verbose); 980 978 unless ($success) { 981 979 print STDERR @$stderr_buf; … … 1030 1028 # mode eq "queue_job" 1031 1029 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 1032 run(command => $command, verbose => $verbose);1030 ps_run(command => $command, verbose => $verbose); 1033 1031 unless ($success) { 1034 1032 print STDERR @$stderr_buf; … … 1139 1137 1140 1138 if (!$no_update) { 1141 my ( $success, $error_msg, $full_buf, $stdout_buf, $stderr_buf ) = 1142 run(command => $command, verbose => $verbose); 1143 my $error_code = &parse_error_message ($success, $error_msg, $command); 1139 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 1140 ps_run(command => $command, verbose => $verbose); 1144 1141 unless ($success) { 1145 my $fault = $error_code ;1142 my $fault = $error_code >> 8; 1146 1143 print STDERR "$command failed with fault $fault\n"; 1147 1144 if ($fault < $PSTAMP_FIRST_ERROR_CODE) { … … 1425 1422 exit $fault; 1426 1423 } 1427 1428 # if the program exited normally, the exit value is returned1429 # if the program exited with a signal (abort, crash, etc), PS_EXIT_PROG_ERROR (4) is returned1430 # if the program failed to run, -PS_EXIT_PROG_ERROR (-4) is returned1431 sub parse_error_message {1432 my $success = shift;1433 my $error_msg = shift;1434 my $command = shift;1435 1436 if ($success) { return 0; }1437 1438 print "raw error_msg: $error_msg\n";1439 print "full command: $command\n";1440 1441 if (&looks_like_number($error_msg)) { return (($error_msg >> 8) or ($PS_EXIT_PROG_ERROR)); }1442 1443 # which of these match?1444 my ($error_code) = $error_msg =~ m/exited with value (\d+)/;1445 if (defined $error_code) { return $error_code; }1446 1447 ($error_code) = $error_msg =~ m/died with signal (\d+)/;1448 # if (defined $error_code) { return (128 + $error_code); }1449 if (defined $error_code) { return ($PS_EXIT_PROG_ERROR); }1450 1451 # probably failed to execute:1452 return (-1*$PS_EXIT_PROG_ERROR);1453 }1454 -
branches/eam_branches/ipp-pstamp-20260421/pstamp/scripts/request_finish.pl
r42981 r43052 10 10 11 11 use Sys::Hostname; 12 use IPC::Cmd 0.36 qw( can_run run);12 use IPC::Cmd 0.36 qw( can_run ); 13 13 use File::Temp qw( tempfile ); 14 14 use File::Copy; … … 19 19 use PS::IPP::Metadata::List qw( parse_md_list ); 20 20 21 use PS::IPP::Config qw( :standard );21 use PS::IPP::Config qw( :standard ps_run ); 22 22 use PS::IPP::PStamp::RequestFile qw( :standard ); 23 23 … … 91 91 $command .= " --save-temps" if $save_temps; 92 92 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 93 run(command => $command, verbose => $verbose);93 ps_run(command => $command, verbose => $verbose); 94 94 unless ($success) { 95 95 die("Unable to perform $command error code: $error_code"); … … 103 103 $command .= " -dbserver $dbserver" if $dbserver; 104 104 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 105 run(command => $command, verbose => $verbose);105 ps_run(command => $command, verbose => $verbose); 106 106 unless ($success) { 107 107 die("Unable to perform $command error code: $error_code");
Note:
See TracChangeset
for help on using the changeset viewer.
