IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Aug 28, 2008, 2:06:45 PM (18 years ago)
Author:
bills
Message:

remove reference to obsolete program

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/pstamp/scripts/pstamp_parser_run.pl

    r19221 r19265  
    33### pstampparser_run.pl
    44###     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
    57###
    6 
    7 #XXX see notes about error handling
    88
    99use warnings;
     
    172172    if (! -d $outProductDir);
    173173
    174 
    175 # run the appropriate parse command to parse the queue the jobs for this request
    176 # first check the extension header to find the EXTNAME
    177 my $request_type = find_request_type($uri);
    178 
    179 print STDERR "request_type for $req_id is $request_type\n" if $verbose;
    180 
    181174my $parse_cmd;
     175my $request_type;
    182176my $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
     178if (-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    }
    189203}
    190204
    191205if (!$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
    194209
    195210    my $command = "$pstamptool -updatereq -req_id $req_id -state run";
     
    211226{
    212227    my $error_file_name = "$workdir/parse_error.txt";
    213     # get rid of any error file from previous run
     228    # get rid of any error file from previous attempt to parse this request
    214229    unlink $error_file_name if (-e $error_file_name);
    215230
     
    219234
    220235    # 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 error
     236    # the file was parseable but one or more of the rows in the request file generated an error
    222237    my $errbuf = join "", @$stderr_buf;
    223238    if ($errbuf) {
     
    258273exit 0;
    259274
     275
    260276sub find_request_type {
    261277    # find the EXTNAME in the input fits table
    262     # TODO: do this right handling errors etc.
    263278    my $file_name = shift;
    264279    my $out = `echo $file_name | fields -x 0 EXTNAME`;
    265280
    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.