- Timestamp:
- Mar 30, 2012, 2:49:37 PM (14 years ago)
- Location:
- branches/eam_branches/ipp-20111122/pstamp/scripts
- Files:
-
- 2 edited
-
. (modified) (1 prop)
-
pstamp_job_run.pl (modified) (10 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20111122/pstamp/scripts
- Property svn:mergeinfo set to
-
branches/eam_branches/ipp-20111122/pstamp/scripts/pstamp_job_run.pl
r32852 r33638 59 59 $options = 1 if !$options; 60 60 61 # We don't need to muggle anymore. Ignore those options 62 $options &= ~($PSTAMP_REQUEST_UNCENSORED | $PSTAMP_REQUIRE_UNCENSORED); 61 63 62 64 my $ipprc = PS::IPP::Config->new(); # IPP Configuration … … 77 79 my $ppstamp = can_run('ppstamp') or (warn "Can't find ppstamp" and $missing_tools = 1); 78 80 my $pstamp_get_image_job = can_run('pstamp_get_image_job.pl') or (warn "Can't find pstamp_get_image_job.pl" and $missing_tools = 1); 79 my $dquery parse = can_run('dqueryparse.pl') or (warn "Can't find dqueryparse.pl" and $missing_tools = 1);81 my $dquery_job_run = can_run('dquery_job_run.pl') or (warn "Can't find dquery_job_run.pl" and $missing_tools = 1); 80 82 my $streaksreplace = can_run('streaksreplace') or (warn "Can't find streaksreplace" and $missing_tools = 1); 81 83 my $magicdstool = can_run('magicdstool') or (warn "Can't find magicdstool" and $missing_tools = 1); … … 88 90 my $mdcParser = PS::IPP::Metadata::Config->new; # Parser for metadata config files 89 91 90 my $params = read_params_file($outputBase);91 92 92 93 my $jobStatus; 93 94 if ($jobType eq "stamp") { 95 my $params = read_params_file($outputBase); 94 96 95 97 my $argString; … … 108 110 $nan_masked = 0; 109 111 $muggle = 1; 112 } 113 114 if ($stage eq "raw") { 115 $options &= ~($PSTAMP_SELECT_MASK | $PSTAMP_SELECT_VARIANCE); 110 116 } 111 117 … … 215 221 } 216 222 223 # MAGIC IS DEAD 224 $nan_masked = 0; 225 217 226 my $command = "$ppstamp $outputBase $argString $fileArgs"; 227 $command .= " -write_jpeg" if ($options & $PSTAMP_SELECT_JPEG); 228 $command .= " -nocompress" if ($options & $PSTAMP_SELECT_UNCOMPRESSED); 229 $command .= " -stage $stage"; 230 $command .= " -censor_masked" if $nan_masked; 218 231 $command .= " -dbname $dbname" if $dbname; 219 232 $command .= " -dbserver $dbserver" if $dbserver; 220 $command .= " -stage $stage";221 $command .= " -no_censor_masked" unless $nan_masked;222 233 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 223 234 run(command => $command, verbose => $verbose); … … 240 251 241 252 # Note: we are assuming the contents of the PSTAMP filerules here. 242 my %extensions = ( $PSTAMP_SELECT_IMAGE => "fits", 243 $PSTAMP_SELECT_MASK => "mk.fits", 244 $PSTAMP_SELECT_VARIANCE => "wt.fits"); 245 246 my $output_mask = $options & ($PSTAMP_SELECT_IMAGE | $PSTAMP_SELECT_MASK | $PSTAMP_SELECT_VARIANCE); 253 my %extensions = ( $PSTAMP_SELECT_IMAGE => "fits", 254 $PSTAMP_SELECT_MASK => "mk.fits", 255 $PSTAMP_SELECT_VARIANCE => "wt.fits", 256 $PSTAMP_SELECT_JPEG => "jpg"); 257 258 my $output_mask = $options & ($PSTAMP_SELECT_IMAGE | $PSTAMP_SELECT_MASK | $PSTAMP_SELECT_VARIANCE | $PSTAMP_SELECT_JPEG); 247 259 248 260 foreach my $key (keys (%extensions)) { … … 274 286 275 287 my $pstamp_bundle_root = metadataLookupStr($ipprc->{_siteConfig}, "PSTAMP_BUNDLE_ROOT"); 288 289 my $params = read_params_file($outputBase); 276 290 my $imagedb = $params->{imagedb}; 277 291 … … 292 306 } 293 307 } elsif ($jobType eq "detect_query") { 294 # detect_query jobs are basically holders to note that we need a file updated before we can continue. 295 # Load the argument list that dqueryparse should have created the first time it ran, so we know how to 296 # run it again the same way. 297 my $argslist = "$outputBase/parse.args"; 298 open ARGSLIST, "<$argslist" or my_die("failed to open argslist file $argslist", $job_id, $PS_EXIT_UNKNOWN_ERROR); 299 my $argString = <ARGSLIST>; 300 close ARGSLIST; 301 chomp $argString; 308 # my $outdir = dirname($outputBase); 309 # my $argslist = "$outdir/parse.args"; 310 # open ARGSLIST, "<$argslist" or my_die("failed to open argslist file $argslist", $job_id, $PS_EXIT_UNKNOWN_ERROR); 311 # my $argString = <ARGSLIST>; 312 # close ARGSLIST; 313 # chomp $argString; 302 314 303 315 # XXX: should we do any other sanity checking? 304 my_die("arglist file $argslist is empty", $job_id, $PS_EXIT_DATA_ERROR) if !$argString;305 306 my $command = "$dquery parse --job_id $job_id $argString";316 # my_die("arglist file $argslist is empty", $job_id, $PS_EXIT_DATA_ERROR) if !$argString; 317 318 my $command = "$dquery_job_run --job_id $job_id --output_base $outputBase"; 307 319 $command .= " --dbname $dbname" if $dbname; 308 320 $command .= " --dbserver $dbserver" if $dbserver; 309 321 $command .= " --verbose" if $verbose; 322 $command .= " --save-temps" if $save_temps; 310 323 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 311 324 run(command => $command, verbose => $verbose); … … 316 329 } else { 317 330 $jobStatus = $error_code >> 8; 318 my_die("dqueryparse.pl failed with error code: $jobStatus", $job_id, $jobStatus); 319 } 331 my_die("dquery_job_run.pl failed with error code: $jobStatus", $job_id, $jobStatus); 332 } 333 } elsif ($jobType eq "child") { 334 # the only thing jobs of jobType child is to finish 335 $jobStatus = 0; 320 336 } else { 321 337 my_die("unknown jobType $jobType found", $job_id, $PS_EXIT_PROG_ERROR); … … 602 618 603 619 $exit_code = $PS_EXIT_PROG_ERROR unless $exit_code; 620 if ($exit_code > 100) { 621 carp ("invalid exit code: $exit_code changing to $PS_EXIT_UNKNOWN_ERROR"); 622 $exit_code = $PS_EXIT_UNKNOWN_ERROR; 623 } 604 624 $job_state = 'run' unless $job_state; 605 625
Note:
See TracChangeset
for help on using the changeset viewer.
