IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Mar 30, 2012, 2:49:37 PM (14 years ago)
Author:
eugene
Message:

merge changes from trunk

Location:
branches/eam_branches/ipp-20111122/pstamp/scripts
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20111122/pstamp/scripts

  • branches/eam_branches/ipp-20111122/pstamp/scripts/pstamp_job_run.pl

    r32852 r33638  
    5959$options = 1 if !$options;
    6060
     61# We don't need to muggle anymore. Ignore those options
     62$options &=  ~($PSTAMP_REQUEST_UNCENSORED | $PSTAMP_REQUIRE_UNCENSORED);
    6163
    6264my $ipprc = PS::IPP::Config->new(); # IPP Configuration
     
    7779my $ppstamp    = can_run('ppstamp') or (warn "Can't find ppstamp" and $missing_tools = 1);
    7880my $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 $dqueryparse = can_run('dqueryparse.pl') or (warn "Can't find dqueryparse.pl" and $missing_tools = 1);
     81my $dquery_job_run = can_run('dquery_job_run.pl') or (warn "Can't find dquery_job_run.pl" and $missing_tools = 1);
    8082my $streaksreplace = can_run('streaksreplace')  or (warn "Can't find streaksreplace"  and $missing_tools = 1);
    8183my $magicdstool = can_run('magicdstool')  or (warn "Can't find magicdstool"  and $missing_tools = 1);
     
    8890my $mdcParser = PS::IPP::Metadata::Config->new; # Parser for metadata config files
    8991
    90 my $params = read_params_file($outputBase);
    9192
    9293my $jobStatus;
    9394if ($jobType eq "stamp") {
     95    my $params = read_params_file($outputBase);
    9496
    9597    my $argString;
     
    108110        $nan_masked = 0;
    109111        $muggle = 1;
     112    }
     113
     114    if ($stage eq "raw") {
     115        $options &= ~($PSTAMP_SELECT_MASK | $PSTAMP_SELECT_VARIANCE);
    110116    }
    111117
     
    215221    }
    216222
     223    # MAGIC IS DEAD
     224    $nan_masked = 0;
     225
    217226    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;
    218231    $command .= " -dbname $dbname" if $dbname;
    219232    $command .= " -dbserver $dbserver" if $dbserver;
    220     $command .= " -stage $stage";
    221     $command .= " -no_censor_masked" unless $nan_masked;
    222233    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    223234        run(command => $command, verbose => $verbose);
     
    240251
    241252        # 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);
    247259
    248260        foreach my $key (keys (%extensions)) {
     
    274286
    275287    my $pstamp_bundle_root = metadataLookupStr($ipprc->{_siteConfig}, "PSTAMP_BUNDLE_ROOT");
     288
     289    my $params = read_params_file($outputBase);
    276290    my $imagedb = $params->{imagedb};
    277291
     
    292306    }
    293307} 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;
    302314
    303315    # 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 = "$dqueryparse --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";
    307319    $command .= " --dbname $dbname" if $dbname;
    308320    $command .= " --dbserver $dbserver" if $dbserver;
    309321    $command .= " --verbose" if $verbose;
     322    $command .= " --save-temps" if $save_temps;
    310323    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    311324        run(command => $command, verbose => $verbose);
     
    316329    } else {
    317330        $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;
    320336} else {
    321337    my_die("unknown jobType $jobType found", $job_id, $PS_EXIT_PROG_ERROR);
     
    602618
    603619    $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    }
    604624    $job_state = 'run' unless $job_state;
    605625
Note: See TracChangeset for help on using the changeset viewer.