Changeset 28229
- Timestamp:
- Jun 4, 2010, 3:20:35 PM (16 years ago)
- File:
-
- 1 edited
-
trunk/pstamp/scripts/pstamp_finish.pl (modified) (10 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/pstamp/scripts/pstamp_finish.pl
r28227 r28229 76 76 if ($product eq "NULL") { 77 77 # nothing more to do 78 stop_request_and_exit($req_id, $PS_EXIT_PROG_ERROR);78 my_die("product is NULL!", $req_id, $PS_EXIT_PROG_ERROR); 79 79 } 80 80 … … 92 92 93 93 if (!mkdir $outdir) { 94 print STDERR "cannot create output directory $outdir"; 95 stop_request_and_exit($req_id, $PS_EXIT_UNKNOWN_ERROR); 94 my_die("cannot create output directory $outdir",$req_id, $PS_EXIT_UNKNOWN_ERROR); 96 95 } 97 96 98 97 99 98 } elsif (! -d $outdir ) { 100 # XXX TODO: fault the request so we pstamp_finish doesn't keep trying to process the 101 # request 102 print STDERR "output directory $outdir exists but is not a directory"; 103 stop_request_and_exit($req_id, $PS_EXIT_UNKNOWN_ERROR); 99 my_die("output directory $outdir exists but is not a directory", $req_id, $PS_EXIT_UNKNOWN_ERROR); 104 100 } 105 101 106 102 if (! -e $req_file ) { 107 print STDERR "request file $req_file is missing\n"; 108 stop_request_and_exit($req_id, $PS_EXIT_CONFIG_ERROR); 103 my_die("request file $req_file is missing", $req_id, $PS_EXIT_CONFIG_ERROR); 109 104 } 110 105 … … 115 110 # Since a request got queued, the request file must have been readable at some 116 111 # point 117 print STDERR "failed to read request_file $req_file" ; 118 stop_request_and_exit($req_id, $PS_EXIT_CONFIG_ERROR); 112 my_die("failed to read request file $req_file", $req_id, $PS_EXIT_CONFIG_ERROR); 119 113 } 120 114 … … 151 145 my $output = join "", @$stdout_buf; 152 146 if (!$output) { 153 if ($verbose) {154 print STDERR "Request $req_id produced no jobs.\n"155 }156 147 # This should not happen. A fake job should have been entered 157 stop_request_and_exit($req_id, $PS_EXIT_PROG_ERROR);148 my_die("Request $req_id produced no jobs", $req_id, $PS_EXIT_PROG_ERROR); 158 149 } else { 159 if (0) {160 my $metadata = $mdcParser->parse($output) or die("Unable to parse metdata config doc");161 162 my $jobs = parse_md_list($metadata);163 }164 150 my $jobs = parse_md_fast($mdcParser, $output); 165 151 … … 181 167 # this request had a duplicate request name yet the parser didn't give 182 168 # it an "ERROR style name. 183 stop_request_and_exit($req_id, $PS_EXIT_PROG_ERROR);169 my_die("duplicate request not given a request name", $req_id, $PS_EXIT_PROG_ERROR); 184 170 } 185 171 my ($row, $req_info, $project) = get_request_info($rows, $rownum); … … 187 173 my $proj_hash = resolve_project($ipprc, $project, $dbname, $dbserver); 188 174 my $image_db = $proj_hash->{dbname}; 189 if (!$image_db) { 190 carp("failed to find imagedb for project: $project"); 191 if (!$fault) { 192 stop_request_and_exit($req_id, $PS_EXIT_CONFIG_ERROR); 193 } 175 if (!$image_db and !$fault) { 176 # if project isn't resolvable, the paser should have faulted this job 177 my_die("failed to find imagedb for project $project", $req_id, $PS_EXIT_CONFIG_ERROR); 194 178 } 195 179 … … 273 257 run(command => $command, verbose => $verbose); 274 258 unless ($success) { 275 print STDERR "Unable to perform $command error code: $error_code\n";276 259 $request_fault = $error_code >> 8; 277 stop_request_and_exit($req_id, $request_fault);260 my_die("Unable to perform $command error code: $error_code", $req_id, $request_fault); 278 261 } 279 262 } … … 283 266 my $command = "$dsreg --list $reglist_name --add $fileset --product $product --type PSRESULTS"; 284 267 $command .= " --link --datapath $outdir --ps0 $req_id"; 285 # XXX: let dsreg and config handle resolving dbname and dbserver286 # $command .= " --dbname $dbname" if $dbname;287 268 288 269 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 289 270 run(command => $command, verbose => $verbose); 290 271 unless ($success) { 291 #die("Unable to perform $command error code: $error_code");292 print STDERR "Unable to perform $command error code: $error_code\n";293 272 $request_fault = $error_code >> 8; 294 stop_request_and_exit($req_id, $request_fault);273 my_die("Unable to perform $command error code: $error_code\n", $req_id, $request_fault); 295 274 } 296 275 } … … 309 288 } 310 289 311 sub stop_request_and_exit{312 # this no longer stops the request. Arguably this should be an old fashioned mydie290 sub my_die { 291 my $msg = shift; 313 292 my $req_id = shift; 314 293 my $fault = shift; 294 295 carp($msg); 315 296 316 297 my $command = "$pstamptool -updatereq -req_id $req_id -set_fault $fault"; … … 447 428 return undef; 448 429 } 449 if (0) {450 my $metadata = $mdcParser->parse($output) or die("Unable to parse metdata config doc");451 452 my $exposures = parse_md_list($metadata);453 }454 430 my $exposures = parse_md_fast($mdcParser, $output); 455 431 my $numExp = @$exposures;
Note:
See TracChangeset
for help on using the changeset viewer.
