Changeset 19265 for trunk/pstamp/scripts/pstamp_parser_run.pl
- Timestamp:
- Aug 28, 2008, 2:06:45 PM (18 years ago)
- File:
-
- 1 edited
-
trunk/pstamp/scripts/pstamp_parser_run.pl (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/pstamp/scripts/pstamp_parser_run.pl
r19221 r19265 3 3 ### pstampparser_run.pl 4 4 ### Run the request parser for a given request id 5 ### This script should be called request_parser.pl since it handles more than postage 6 ### stamp requests 5 7 ### 6 7 #XXX see notes about error handling8 8 9 9 use warnings; … … 172 172 if (! -d $outProductDir); 173 173 174 175 # run the appropriate parse command to parse the queue the jobs for this request176 # first check the extension header to find the EXTNAME177 my $request_type = find_request_type($uri);178 179 print STDERR "request_type for $req_id is $request_type\n" if $verbose;180 181 174 my $parse_cmd; 175 my $request_type; 182 176 my $reqType; # for the database 183 if ($request_type eq "PS1_PS_REQUEST") { 184 $reqType = 'pstamp'; 185 $parse_cmd = $pstampparse; 186 } elsif ($request_type eq "MOPS_DETECTABILITY_QUERY") { 187 $reqType = 'dquery'; 188 $parse_cmd = $dqueryparse; 177 178 if (-r $uri) { 179 # run the appropriate parse command to parse the queue the jobs for this request 180 # first check the extension header to find the EXTNAME 181 $request_type = find_request_type($uri); 182 183 if ($request_type) { 184 print STDERR "request_type for $req_id is $request_type\n" if $verbose; 185 if ($request_type eq "PS1_PS_REQUEST") { 186 $reqType = 'pstamp'; 187 $parse_cmd = $pstampparse; 188 } elsif ($request_type eq "MOPS_DETECTABILITY_QUERY") { 189 $reqType = 'dquery'; 190 $parse_cmd = $dqueryparse; 191 } else { 192 print STDERR "Unknown request type $request_type found in $uri"; 193 } 194 } else { 195 print STDERR "No EXTNAME found keyword in $uri"; 196 } 197 } else { 198 if (-e $uri) { 199 print STDERR "Request file $uri is not readable"; 200 } else { 201 print STDERR "Request file $uri does not exist"; 202 } 189 203 } 190 204 191 205 if (!$parse_cmd) { 192 print STDERR "No EXTNAME found in $uri" if !$request_type; 193 print STDERR "Unknown request type $request_type found in $uri"; 206 # can't go any farther, set fault and set request state to run 207 # request_finish.pl will clean up, perhaps notifiying the operator of the input data store 208 # that they sent us a request file that we don't understand 194 209 195 210 my $command = "$pstamptool -updatereq -req_id $req_id -state run"; … … 211 226 { 212 227 my $error_file_name = "$workdir/parse_error.txt"; 213 # get rid of any error file from previous run228 # get rid of any error file from previous attempt to parse this request 214 229 unlink $error_file_name if (-e $error_file_name); 215 230 … … 219 234 220 235 # save the contents of stderr (if any) to a file. This is relevant if 221 # the file parsed properl but one of the rows in the request file generated an error236 # the file was parseable but one or more of the rows in the request file generated an error 222 237 my $errbuf = join "", @$stderr_buf; 223 238 if ($errbuf) { … … 258 273 exit 0; 259 274 275 260 276 sub find_request_type { 261 277 # find the EXTNAME in the input fits table 262 # TODO: do this right handling errors etc.263 278 my $file_name = shift; 264 279 my $out = `echo $file_name | fields -x 0 EXTNAME`; 265 280 266 # output from fields is filename value 267 my ($dummy, $extname) = split " ", $out; 268 269 return $extname; 270 } 281 if ($out) { 282 # output from fields is filename value 283 my ($dummy, $extname) = split " ", $out; 284 285 return $extname; 286 } else { 287 return undef; 288 } 289 }
Note:
See TracChangeset
for help on using the changeset viewer.
