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/dqueryparse.pl

    r27859 r27874  
    2626
    2727my ($no_update, $imagedb, $label);
    28 my ($req_file, $req_id, $out_dir, $product, $mode, $dbname, $dbserver, $verbose, $save_temps);
     28my ($req_file, $req_id, $outdir, $product, $mode, $dbname, $dbserver, $verbose, $save_temps);
    2929my ($job_id,$rownum); # stuff from the post-update world
    3030#
     
    3737        'job_id=s'        =>      \$job_id,
    3838        'rownum=s'        =>      \$rownum,
    39         'out_dir=s'       =>      \$out_dir,
     39        'outdir=s'       =>      \$outdir,
    4040        'label=s'         =>      \$label,
    4141        'product=s'       =>      \$product,
     
    5252if ($mode ne "list_uri") {
    5353    die "req_id is required" if !$req_id;
    54     die "out_dir is required" if !$out_dir;
     54    die "outdir is required" if !$outdir;
    5555    die "product is required" if !$product;
    5656}
     
    8080# Unless we're running as a job, write the parse arguments in case we need to rerun this parsing.
    8181if (!$job_id) {
    82     my $argslist = "$out_dir/parse.args";
     82    my $argslist = "$outdir/parse.args";
    8383    open ARGSLIST, ">$argslist" or my_die("failed to open argslist file $argslist", $job_id, $PS_EXIT_UNKNOWN_ERROR);
    84     print ARGSLIST "--label $label --mode $mode --req_id $req_id --product $product --out_dir $out_dir --file $req_file\n";
     84    print ARGSLIST "--label $label --mode $mode --req_id $req_id --product $product --outdir $outdir --file $req_file\n";
    8585    close ARGSLIST;
    8686}
     
    105105
    106106# Set up the workdir for this query.
    107 if (! -e $out_dir ) {
    108     mkdir $out_dir or my_die("cannot create output directory $out_dir", $PS_EXIT_PROG_ERROR);
    109 } elsif (! -d $out_dir ) {
    110     my_die ("output fileset directory $out_dir exists but is not a directory", $PS_EXIT_PROG_ERROR);
     107if (! -e $outdir ) {
     108    mkdir $outdir or my_die("cannot create output directory $outdir", $PS_EXIT_PROG_ERROR);
     109} elsif (! -d $outdir ) {
     110    my_die ("output fileset directory $outdir exists but is not a directory", $PS_EXIT_PROG_ERROR);
    111111}
    112112
    113113
    114114# Pass along the request file to the response generator.
    115 my $response_file = "$out_dir/${req_name}.dresponse.${req_id}.fits";
     115my $response_file = "$outdir/${req_name}.dresponse.${req_id}.fits";
    116116my $fault;
    117117my $data_to_update = '';
    118118{
    119     my $command = "$detectresponse --input $req_file --output $response_file --workdir $out_dir";
     119    my $command = "$detectresponse --input $req_file --output $response_file --workdir $outdir";
    120120    $command .= " --save-temps" if $save_temps;
    121121    $command .= " --verbose" if $verbose;
     
    137137# for the completed work, and move the response to a standardized name.
    138138if ($fault == 0) {
    139     my $command = "$pstamptool -addjob -req_id $req_id -outputBase $out_dir";
     139    my $command = "$pstamptool -addjob -req_id $req_id -outputBase $outdir";
    140140    $command .= " -job_type detect_query -state stop -fault 0";
    141141    $command .= " -rownum 1";
     
    147147        chomp $job_id;
    148148        if ($job_id && -e $response_file) {
    149             rename $response_file, "$out_dir/response${job_id}.fits";
     149            rename $response_file, "$outdir/response${job_id}.fits";
    150150        }
    151151        $result = 0;
     
    158158    # Failed to run correctly, which means that we need to queue a job and flag data for updating.
    159159    # Get the dependency id for the data we're requesting be updated.
    160     my $dep_id = queue_update_run($req_id,$job_id,$out_dir,$label,$data_to_update);
     160    my $dep_id = queue_update_run($req_id,$job_id,$outdir,$label,$data_to_update);
    161161
    162162    # Link this request to a job and link that job to any dependency
    163     my $command = "$pstamptool -addjob -req_id $req_id -outputBase $out_dir";
     163    my $command = "$pstamptool -addjob -req_id $req_id -outputBase $outdir";
    164164    $command .= " -job_type detect_query -state run -fault 0";
    165165    $command .= " -rownum 1";
     
    174174        if ($job_id && -e $response_file) {
    175175            # We shouldn't have a response file at this stage.
    176             rename $response_file, "$out_dir/response${job_id}.fits";
     176            rename $response_file, "$outdir/response${job_id}.fits";
    177177        }
    178178        $result = 0;
     
    186186# which will notice that we've inserted the stopped job and decide we're finished. Easy enough.
    187187{
    188     my $command = "$pstamptool -updatereq -req_id $req_id -name $req_name -outProduct $product";
    189     $command .= " -fault $result" if $result;
     188    my $command = "$pstamptool -updatereq -req_id $req_id -set_name $req_name -set_outProduct $product";
     189    $command .= " -set_fault $result" if $result;
    190190
    191191    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
     
    201201# If we have to queue an update run, do so and create a new dependent
    202202sub queue_update_run {
    203     my ($req_id, $job_id, $out_dir, $label, $data_to_update) = @_;
     203    my ($req_id, $job_id, $outdir, $label, $data_to_update) = @_;
    204204
    205205    my ($state, $stage, $stage_id, $component, $need_magic, $imagedb) = split /\s+/, $data_to_update;
     
    211211    my $dep_id;
    212212    my $command = "$pstamptool -getdependent -stage $stage -stage_id $stage_id -imagedb $imagedb -component $component ";
    213     $command .= " -outdir $out_dir";
     213    $command .= " -outdir $outdir";
    214214    $command .= " -need_magic" if $need_magic;
    215215
Note: See TracChangeset for help on using the changeset viewer.