Changeset 18587 for trunk/pstamp/scripts/pstamp_finish.pl
- Timestamp:
- Jul 16, 2008, 3:27:19 PM (18 years ago)
- File:
-
- 1 edited
-
trunk/pstamp/scripts/pstamp_finish.pl (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/pstamp/scripts/pstamp_finish.pl
r18533 r18587 31 31 32 32 33 my ( $ dbname, $limit, $verbose, $save_temps );33 my ( $req_id, $req_name, $product, $dbname, $verbose, $save_temps ); 34 34 35 35 # the char to the right of the bar may be used as a single - alias for the longer name 36 36 # for example --input and -i are equivalent 37 37 GetOptions( 38 'limit=s' => \$limit, 38 'req_id=s' => \$req_id, 39 'req_name=s' => \$req_name, 40 'product=s' => \$product, 39 41 'dbname=s' => \$dbname, 40 'verbose' => \$verbose,42 'verbose' => \$verbose, 41 43 'save-temps' => \$save_temps, 42 44 ) or pod2usage( 2 ); … … 62 64 my $mdcParser = PS::IPP::Metadata::Config->new; # Parser for metadata config files 63 65 64 my @requests;65 66 { 66 my $command = "$pstamptool -completedreq";67 $command .= " -limit $limit" if $limit;68 $command .= " -dbname $dbname" if $dbname;69 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =70 run(command => $command, verbose => $verbose);71 unless ($success) {72 die("Unable to perform $command error code: $error_code");73 }74 my $output = join "", @$stdout_buf;75 if (!$output) {76 if ($verbose) {77 print STDERR "no completed requests pending\n"78 }79 exit 0;80 }81 my $metadata = $mdcParser->parse($output) or die("Unable to parse metdata config doc");82 83 my $requests = parse_md_list($metadata);84 85 @requests = @$requests86 }87 88 foreach my $req (@requests) {89 my $req_id = $req->{req_id};90 91 my $product = $req->{outProduct};92 die "outProduct in request is null" if !$product;93 94 my $req_name = $req->{name};95 die "request name is null" if !$req_name;96 97 98 67 # set the output fileset's name to the request name. 99 68 my $fileset = $req_name; … … 156 125 # including those that produced no jobs. 157 126 # for now add an entry for rownum 1 and a phony error code. 158 #159 # possible fix: have pstampparse add a dummy job with state=stop and a fault code160 127 # we've included parse_results.txt to the fileset if it exists 161 128 # … … 169 136 my $jobs = parse_md_list($metadata); 170 137 171 @jobs = @$jobs 138 @jobs = @$jobs; 172 139 } 173 140 } … … 201 168 } 202 169 } else { 203 die "Unknown jobType: $job_type"; 170 print STDERR "Unknown jobType: $job_type"; 171 next; 204 172 } 205 173 } … … 235 203 # set the request's state to stop 236 204 { 237 238 205 my $command = "$pstamptool -processedreq -req_id $req_id -state stop -fault $request_fault"; 239 206 $command .= " -dbname $dbname" if $dbname; … … 245 212 } 246 213 } 214 sub stop_request { 215 my $req_id = shift; 216 my $fault = shift; 217 my $dbname = shift; 218 219 my $command = "$pstamptool -processedreq -req_id $req_id -state stop -fault $fault"; 220 $command .= " -dbname $dbname" if $dbname; 221 222 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 223 run(command => $command, verbose => $verbose); 224 unless ($success) { 225 die("Unable to perform $command error code: $error_code"); 226 } 227 }
Note:
See TracChangeset
for help on using the changeset viewer.
