Changeset 16591 for trunk/pstamp/scripts/ppstamp_run.pl
- Timestamp:
- Feb 21, 2008, 6:38:46 PM (18 years ago)
- File:
-
- 1 edited
-
trunk/pstamp/scripts/ppstamp_run.pl (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/pstamp/scripts/ppstamp_run.pl
r16358 r16591 15 15 my $job_id = $ARGV[0]; 16 16 17 my $verbosity = 0;17 my $verbosity = 1; 18 18 19 19 use Sys::Hostname; 20 20 my $host = hostname(); 21 21 22 print "\n\n"; 22 23 print "Starting script $0 on $host\n\n"; 24 23 25 use IPC::Cmd 0.36 qw( can_run run ); 24 26 … … 58 60 run(command => $command, verbose => $verbosity); 59 61 unless ($success) { 60 die("Unable to perform pstamptool -pending req: $error_code");62 die("Unable to perform pstamptool -pendingjob: $error_code"); 61 63 } 62 64 63 65 if (@$stdout_buf == 0) { 64 66 print STDERR "pending pstamp job id $job_id not found\n"; 65 exit 1; 67 # exit 1; 68 exit 0; 66 69 } 67 70 my $metadata = $mdcParser->parse(join "", @$stdout_buf) or … … 82 85 my $outputBase = $psjob->{outputBase}; 83 86 my $argString = $psjob->{args}; 84 #my $request_id = $psjob->{req_id};85 86 #87 # update the state of this job from 'new' to 'run'88 #89 {90 my $command = "$pstamptool -processedjob -job_id $job_id -state run";91 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =92 run(command => $command, verbose => $verbosity);93 unless ($success) {94 die("Unable to perform $command: $error_code");95 }96 }97 87 98 88 my $jobStatus; … … 103 93 104 94 if ($success) { 105 $jobStatus = "ok";95 $jobStatus = $PS_EXIT_SUCCESS; 106 96 } else { 107 $jobStatus = $error_code; 108 print STDERR "ppstamp failed with error code $error_code\n"; 97 # run shifts the unix exit status up by 8 bits for some reason 98 $jobStatus = $error_code >> 8; 99 print STDERR "ppstamp failed with error code: $jobStatus\n"; 109 100 } 110 # unless ($success) {111 # die("Unable to perform $command: $error_code");112 # }113 101 } 114 102 115 103 116 # stop the job and set the error status104 # stop the job and set the result value 117 105 { 118 my $command = "$pstamptool -processedjob -job_id $job_id -state stop - status$jobStatus";106 my $command = "$pstamptool -processedjob -job_id $job_id -state stop -result $jobStatus"; 119 107 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 120 108 run(command => $command, verbose => $verbosity); … … 124 112 } 125 113 126 127 if ($jobStatus eq "ok") { 128 exit 0; 129 } else { 130 exit $jobStatus; 131 } 114 exit $jobStatus;
Note:
See TracChangeset
for help on using the changeset viewer.
