IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
May 6, 2010, 1:55:20 PM (16 years ago)
Author:
bills
Message:

Various changes to the postage stamp server and associated tables.
Implemented cleanup. Added pstampRequest.outdir changed spelling of out_dir
to outdir. various other cleanups

File:
1 edited

Legend:

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

    r27859 r27874  
    2828my $redirect_output;
    2929my $product;
     30my $outdir;
    3031my $label;
    3132my $verbose;
     
    3738    'uri=s'             =>  \$uri,
    3839    'product=s'         =>  \$product,
     40    'outdir=s'          =>  \$outdir,
    3941    'label=s'           =>  \$label,
    4042    'redirect-output'   =>  \$redirect_output,
     
    8183}
    8284
    83 # workdir is where all of the files generated for this request are placed
    84 # NOTE: this location needs to be kept in sync with the web interface ( request.php )
    85 my $datestr = strftime "%Y%m%d", gmtime;
    86 my $datedir = "$pstamp_workdir/$datestr";
    87 if (! -e $datedir ) {
    88     mkdir $datedir or my_die( "failed to create working directory $datedir for request id $req_id", $req_id,
     85if (!$outdir or ($outdir eq "NULL")) {
     86    # workdir is where all of the files generated for this request are placed
     87    # NOTE: this location needs to be kept in sync with the web interface ( request.php )
     88    my $datestr = strftime "%Y%m%d", gmtime;
     89    my $datedir = "$pstamp_workdir/$datestr";
     90    if (! -e $datedir ) {
     91        mkdir $datedir or my_die( "failed to create working directory $datedir for request id $req_id", $req_id,
     92            $PS_EXIT_CONFIG_ERROR);
     93    }
     94
     95    $outdir = "$datedir/$req_id";
     96}
     97
     98if (! -e $outdir ) {
     99    mkdir $outdir or my_die("failed to create working directory $outdir for request id $req_id", $req_id,
    89100        $PS_EXIT_CONFIG_ERROR);
    90101}
    91 
    92 my $workdir = "$datedir/$req_id";
    93 if (! -e $workdir ) {
    94     mkdir $workdir or my_die("failed to create working directory $workdir for request id $req_id", $req_id,
    95         $PS_EXIT_CONFIG_ERROR);
    96 }
     102   
    97103
    98104if ($redirect_output) {
    99     my $logDest = "$workdir/psparse.$req_id.log";
     105    my $logDest = "$outdir/psparse.$req_id.log";
    100106    $ipprc->redirect_output($logDest);
    101107}
     
    108114
    109115my $fn = basename($uri);
    110 my $new_uri = "$workdir/$fn";
     116my $new_uri = "$outdir/$fn";
    111117if ($uri =~ /^http:/) {
    112118    # if the uri is an http uri download the file
     
    123129    }
    124130    if (! copy $uri, $new_uri) {
    125         my_die ("failed to copy request file $uri to workdir $workdir", $req_id, $PS_EXIT_UNKNOWN_ERROR);
     131        my_die ("failed to copy request file $uri to workdir $outdir", $req_id, $PS_EXIT_UNKNOWN_ERROR);
    126132    }
    127133}
     
    173179    # that they sent us a request file that we don't understand
    174180
    175     my $command = "$pstamptool -updatereq -req_id $req_id -state run";
    176     $command   .= " -reqType unknown";
    177     $command   .= " -fault $PS_EXIT_DATA_ERROR";
     181    my $command = "$pstamptool -updatereq -req_id $req_id -set_state run";
     182    $command   .= " -set_reqType unknown";
     183    $command   .= " -set_fault $PS_EXIT_DATA_ERROR";
    178184    $command   .= " -dbname $dbname" if $dbname;
    179185    $command   .= " -dbserver $dbserver" if $dbserver;
     
    186192}
    187193
    188 $parse_cmd .= " --mode queue_job --req_id $req_id --product $product --out_dir $workdir --file $uri";
     194$parse_cmd .= " --mode queue_job --req_id $req_id --product $product --outdir $outdir --file $uri";
    189195$parse_cmd .= " --dbname $dbname" if $dbname;
    190196$parse_cmd .= " --dbserver $dbserver" if $dbserver;
     
    194200my $fault;
    195201{
    196     my $error_file_name = "$workdir/parse_error.txt";
     202    my $error_file_name = "$outdir/parse_error.txt";
    197203    # get rid of any error file from previous attempt to parse this request
    198204    unlink $error_file_name if (-e $error_file_name);
     
    227233#
    228234{
    229     my $command = "$pstamptool -updatereq -req_id $req_id -state $newState";
    230     $command   .= " -reqType $reqType" if $reqType;
    231     $command   .= " -uri $new_uri" if $new_uri;
    232     $command   .= " -fault $fault" if $fault;
     235    my $command = "$pstamptool -updatereq -req_id $req_id -set_state $newState";
     236    $command   .= " -set_outdir $outdir";
     237    $command   .= " -set_reqType $reqType" if $reqType;
     238    $command   .= " -set_uri $new_uri" if $new_uri;
     239    $command   .= " -set_fault $fault" if $fault;
    233240    $command   .= " -dbname $dbname" if $dbname;
    234241    $command   .= " -dbserver $dbserver" if $dbserver;
     
    269276    carp($msg);
    270277
    271     my $command = "$pstamptool -updatereq -req_id $req_id  -fault $fault";
     278    my $command = "$pstamptool -updatereq -req_id $req_id  -set_fault $fault";
    272279    $command   .= " -dbname $dbname" if $dbname;
    273280    $command   .= " -dbserver $dbserver" if $dbserver;
Note: See TracChangeset for help on using the changeset viewer.