Changeset 27874 for trunk/pstamp/scripts/dqueryparse.pl
- Timestamp:
- May 6, 2010, 1:55:20 PM (16 years ago)
- File:
-
- 1 edited
-
trunk/pstamp/scripts/dqueryparse.pl (modified) (12 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/pstamp/scripts/dqueryparse.pl
r27859 r27874 26 26 27 27 my ($no_update, $imagedb, $label); 28 my ($req_file, $req_id, $out _dir, $product, $mode, $dbname, $dbserver, $verbose, $save_temps);28 my ($req_file, $req_id, $outdir, $product, $mode, $dbname, $dbserver, $verbose, $save_temps); 29 29 my ($job_id,$rownum); # stuff from the post-update world 30 30 # … … 37 37 'job_id=s' => \$job_id, 38 38 'rownum=s' => \$rownum, 39 'out _dir=s' => \$out_dir,39 'outdir=s' => \$outdir, 40 40 'label=s' => \$label, 41 41 'product=s' => \$product, … … 52 52 if ($mode ne "list_uri") { 53 53 die "req_id is required" if !$req_id; 54 die "out _dir is required" if !$out_dir;54 die "outdir is required" if !$outdir; 55 55 die "product is required" if !$product; 56 56 } … … 80 80 # Unless we're running as a job, write the parse arguments in case we need to rerun this parsing. 81 81 if (!$job_id) { 82 my $argslist = "$out _dir/parse.args";82 my $argslist = "$outdir/parse.args"; 83 83 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"; 85 85 close ARGSLIST; 86 86 } … … 105 105 106 106 # 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);107 if (! -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); 111 111 } 112 112 113 113 114 114 # Pass along the request file to the response generator. 115 my $response_file = "$out _dir/${req_name}.dresponse.${req_id}.fits";115 my $response_file = "$outdir/${req_name}.dresponse.${req_id}.fits"; 116 116 my $fault; 117 117 my $data_to_update = ''; 118 118 { 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"; 120 120 $command .= " --save-temps" if $save_temps; 121 121 $command .= " --verbose" if $verbose; … … 137 137 # for the completed work, and move the response to a standardized name. 138 138 if ($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"; 140 140 $command .= " -job_type detect_query -state stop -fault 0"; 141 141 $command .= " -rownum 1"; … … 147 147 chomp $job_id; 148 148 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"; 150 150 } 151 151 $result = 0; … … 158 158 # Failed to run correctly, which means that we need to queue a job and flag data for updating. 159 159 # 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); 161 161 162 162 # 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"; 164 164 $command .= " -job_type detect_query -state run -fault 0"; 165 165 $command .= " -rownum 1"; … … 174 174 if ($job_id && -e $response_file) { 175 175 # 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"; 177 177 } 178 178 $result = 0; … … 186 186 # which will notice that we've inserted the stopped job and decide we're finished. Easy enough. 187 187 { 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; 190 190 191 191 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = … … 201 201 # If we have to queue an update run, do so and create a new dependent 202 202 sub 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) = @_; 204 204 205 205 my ($state, $stage, $stage_id, $component, $need_magic, $imagedb) = split /\s+/, $data_to_update; … … 211 211 my $dep_id; 212 212 my $command = "$pstamptool -getdependent -stage $stage -stage_id $stage_id -imagedb $imagedb -component $component "; 213 $command .= " -outdir $out _dir";213 $command .= " -outdir $outdir"; 214 214 $command .= " -need_magic" if $need_magic; 215 215
Note:
See TracChangeset
for help on using the changeset viewer.
