IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 31430


Ignore:
Timestamp:
May 4, 2011, 2:20:59 PM (15 years ago)
Author:
watersc1
Message:

Fixed segfault in laptool -updaterun (expected state to always be defined, but that's not true). Final touches on lap_science.pl to have consistent counts and error messages.

Location:
branches/czw_branch/20110406
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/czw_branch/20110406/ippScripts/scripts/lap_science.pl

    r31429 r31430  
    2525my $laptool  = can_run('laptool') or (warn "Can't find laptool" and $missing_tools = 1);
    2626
    27 my ( $help, $verbose, $debug);
     27my ( $help, $verbose, $debug, $do_nothing);
    2828my ( $camera, $dbname);
    2929my ( $lap_id );
     
    3434    'verbose'      => \$verbose,
    3535    'debug'        => \$debug,
     36    'do_nothing'   => \$do_nothing,
    3637
    3738    'camera=s'     => \$camera,
     
    106107        unless ($success) {
    107108            $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
    108             &my_die("Unable to perform laptool: $error_code", $lap_id);
     109            &my_die("Unable to perform laptool -updaterun: $error_code", $lap_id);
    109110        }
    110111    }
     
    126127    unless ($success) {
    127128        $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
    128         &my_die("Unable to perform chiptool: $error_code", $exp_id, $data_group);
     129        &my_die("Unable to perform chiptool -listrun: $error_code", $exp_id, $data_group);
    129130    }
    130131    my $chips = $mdcParser->parse_list(join "", @$stdout_buf) or
    131         &my_die("Unable to parse metadata from chiptool", $exp_id, $data_group);
     132        &my_die("Unable to parse metadata from chiptool -listrun", $exp_id, $data_group);
    132133    # There should be only one.
    133134    my $chip = ${ $chips }[0];
     
    148149    unless ($success) {
    149150        $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
    150         &my_die("Unable to perform laptool: $error_code", $lap_id);
     151        &my_die("Unable to perform laptool -pendingrun: $error_code", $lap_id);
    151152    }
    152153    my $Runs = $mdcParser->parse_list(join "", @$stdout_buf) or
    153         &my_die("Unable to parse metadata from laptool", $lap_id);
     154        &my_die("Unable to parse metadata from laptool -pendingrun", $lap_id);
    154155    # There should be only one.
    155156    my $Run = ${ $Runs }[0];
     
    186187    unless ($success) {
    187188        $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
    188         &my_die("Unable to perform chiptool: $error_code", $exposure->{lap_id}, $exposure->{proj_cell});
     189        &my_die("Unable to perform chiptool -definebyquery: $error_code", $exposure->{lap_id}, $exposure->{proj_cell});
    189190    }
    190191   
     
    205206    unless ($success) {
    206207        $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
    207         &my_die("Unable to perform laptool: $error_code", $lap_id);
     208        &my_die("Unable to perform laptool -pendingexp: $error_code", $lap_id);
    208209    }
    209210   
     
    214215   
    215216    my $exposures = $mdcParser->parse_list(join "", @$stdout_buf) or
    216         &my_die("Unable to parse metadata from laptool", $lap_id);
     217        &my_die("Unable to parse metadata from laptool -pendingexp", $lap_id);
    217218
    218219    my $counter = 0;
     
    324325    unless($success) {
    325326        $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
    326         &my_die("Unable to perform laptool: $error_code", $lap_id, "");
     327        &my_die("Unable to perform laptool -stacks: $error_code", $lap_id, "");
    327328    }
    328329
     
    334335
    335336    my $stacks = $mdcParser->parse_list(join "", @$stdout_buf) or
    336         &my_die("Unable to parse metadata from laptool", $lap_id, "");
     337        &my_die("Unable to parse metadata from laptool -stacks", $lap_id, "");
    337338
    338339    my $total_qstacks = 0;
     
    396397    unless ($success) {
    397398        $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
    398         &my_die("Unable to perform laptool: $error_code", $lap_id);
     399        &my_die("Unable to perform laptool -exposures: $error_code", $lap_id);
    399400    }
    400401   
     
    405406   
    406407    my $exposures = $mdcParser->parse_list(join "", @$stdout_buf) or
    407         &my_die("Unable to parse metadata from laptool", $lap_id);
     408        &my_die("Unable to parse metadata from laptool -exposures", $lap_id);
    408409
    409410    # Need to prescan to see who matches whom.
     
    466467#           }
    467468#       }
    468         if ((($exposure->{warpRun_state})&&  # This exposure has a warp
    469             ($exposure->{warpRun_state} eq 'full'))|| # This exposure's warp is either done or impossible.
    470              ($exposure->{data_state} eq 'drop')) {
     469        if  ($exposure->{data_state} eq 'drop') { # This exposure is impossible, so fudge the counts so we get through.
    471470            $can_qstack ++;
    472471            $can_diff ++;
     472            $have_diff ++;
     473            $can_fstack ++;         
     474            next;
     475        }
     476
     477        if (($exposure->{warpRun_state})&&  # This exposure has a warp
     478            ($exposure->{warpRun_state} eq 'full')) { # This exposure's warp is done.
     479            $can_qstack ++;
     480            $can_diff ++;
    473481        }
    474482        if (($exposure->{magicked}&&
    475              &S64_IS_NOT_NULL($exposure->{magicked}))||  # This exposure has been magicked, so it is through with diff.
    476             ($exposure->{data_state} eq 'drop')) {
     483             &S64_IS_NOT_NULL($exposure->{magicked}))) {  # This exposure has been magicked, so it is through with diff.
    477484            $can_fstack ++;
    478485        }
     
    497504
    498505    print "STATUS: TOTAL_EXPOSURES: $total_exposures\n";
    499 
     506    if ($do_nothing) {
     507        exit(0);
     508    }
    500509    if (($needs_qstack == 1)&&              # Do we need the quick stack?
    501510        ($defined_qstack == 0)&&            # Have we not made it already?
     
    533542        unless ($success) {
    534543            $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
    535             &my_die("Unable to perform laptool: $error_code", $lap_id);
     544            &my_die("Unable to perform laptool -updaterun: $error_code", $lap_id);
    536545        }
    537546    }
     
    564573    $command .= " -dbname $dbname " if defined $dbname;
    565574    $command .= " -definebyquery -select_label $label -select_skycell_id ${proj_cell}.% -select_filter $filter ";
    566     $command .= " -set_label ${label}.quick -set_data_group ${proj_cell}.quick.${date} ";
     575    $command .= " -set_label ${label} -set_data_group ${proj_cell}.quick.${date} ";
    567576    $command .= "  -set_workdir $workdir  -set_dist_group NODIST ";
    568577    $command .= " -min_num 2 -set_reduction QUICKSTACK ";
     
    572581    unless ($success) {
    573582        $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
    574         &my_die("Unable to perform chiptool: $error_code", $lap_id);
     583        &my_die("Unable to perform stacktool -definebyquery: $error_code", $lap_id);
    575584    }
    576585
     
    584593    unless ($success) {
    585594        $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
    586         &my_die("Unable to perform chiptool: $error_code", $lap_id);
     595        &my_die("Unable to perform stacktool -sassskyfile: $error_code", $lap_id);
    587596    }
    588597   
    589598    my $stacks = $mdcParser->parse_list(join "", @$stdout_buf) or
    590         &my_die("Unable to parse metadata from laptool", $lap_id, "");
     599        &my_die("Unable to parse metadata from stacktool -sassskyfile", $lap_id, "");
    591600   
    592601    my $stack = ${ $stacks }[0];
     
    604613    unless ($success) {
    605614        $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
    606         &my_die("Unable to perform chiptool: $error_code", $lap_id);
     615        &my_die("Unable to perform laptool -updaterun: $error_code", $lap_id);
    607616    }
    608617   
     
    634643    $command .= " -dbname $dbname " if defined $dbname;
    635644    $command .= " -definebyquery -select_label $label -select_skycell_id ${proj_cell}.% -select_filter $filter ";
    636     $command .= " -set_label ${label}.final -set_workdir $workdir -set_data_group ${proj_cell}.final.${date} ";
     645    $command .= " -set_label ${label} -set_workdir $workdir -set_data_group ${proj_cell}.final.${date} ";
    637646    $command .= " -min_num 2 -set_reduction THREEPI_STACK ";
    638647
     
    641650    unless ($success) {
    642651        $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
    643         &my_die("Unable to perform chiptool: $error_code", $lap_id);
     652        &my_die("Unable to perform stacktool -definebyquery: $error_code", $lap_id);
    644653    }
    645654   
     
    654663    unless ($success) {
    655664        $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
    656         &my_die("Unable to perform chiptool: $error_code", $lap_id);
     665        &my_die("Unable to perform stacktool -sassskyfile: $error_code", $lap_id);
    657666    }
    658667
    659668    my $stacks = $mdcParser->parse_list(join "", @$stdout_buf) or
    660         &my_die("Unable to parse metadata from laptool", $lap_id, "");
     669        &my_die("Unable to parse metadata from stacktool -sassskyfile", $lap_id, "");
    661670
    662671    my $stack = ${ $stacks }[0];
     
    673682    unless ($success) {
    674683        $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
    675         &my_die("Unable to perform chiptool: $error_code", $lap_id);
     684        &my_die("Unable to perform laptool -updaterun: $error_code", $lap_id);
    676685    }
    677686
     
    742751        unless ($success) {
    743752            $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
    744             &my_die("unable to perform difftool: $error_code", $exposure->{lap_id}, $exposure->{proj_cell});
     753            &my_die("unable to perform difftool -definewarp(warp|stack): $error_code", $exposure->{lap_id}, $exposure->{proj_cell});
    745754        }
    746755       
    747756        my $diffs = $mdcParser->parse_list(join "", @$stdout_buf) or
    748             &my_die("Unable to parse metadata from laptool", $lap_id, "");
     757            &my_die("Unable to parse metadata from difftool -definewarp(warp|stack)", $lap_id, "");
    749758       
    750759        my $diff = ${ $diffs }[0];
     
    781790    unless ($success) {
    782791        $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
    783         &my_die("Unable to perform laptool: $error_code", "none", "none");
     792        &my_die("Unable to perform laptool -inactiveexp: $error_code", "none", "none");
    784793    }
    785794    if (@$stdout_buf == 0) {
     
    789798   
    790799    my $exposures = $mdcParser->parse_list(join "", @$stdout_buf) or
    791         &my_die("Unable to parse metadata from laptool", $lap_id);
     800        &my_die("Unable to parse metadata from laptool -inactiveexp", $lap_id);
    792801
    793802    my @clean_modes = (
     
    814823            unless ($success) {
    815824                $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
    816                 &my_die("Unable to perform laptool: $error_code", "none", "none");
     825                &my_die("Unable to perform cleantool: $command : $error_code", "none", "none");
    817826            }
    818827        }
     
    893902    unless ($success) {
    894903        $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
    895         &my_die("Unable to perform laptool: $error_code", $exposure->{lap_id}, $exposure->{proj_cell});
     904        &my_die("Unable to perform laptool -updateexp: $error_code", $exposure->{lap_id}, $exposure->{proj_cell});
    896905    }
    897906}   
  • branches/czw_branch/20110406/ippTools/src/laptool.c

    r31429 r31430  
    460460  if (rows) {
    461461    // We're done with these exposures now, so mark them as inactive.
    462     if ((strcmp(state,"drop") == 0)||
    463         (strcmp(state,"full") == 0)) {
    464       values = psMetadataAlloc();
    465       psMetadataAddBool(values, PS_LIST_TAIL, "active", 0, "", false);
    466       long exps = psDBUpdateRows(config->dbh, "lapExp", where, values);
    467 
    468       if (exps) {
    469         return(true);
    470       }
    471       else {
    472         return(true); // We shouldn't really fail if we didn't change anything. Maybe there's nothing to change.
     462    if (state) {
     463      if ((strcmp(state,"drop") == 0)||
     464          (strcmp(state,"full") == 0)) {
     465        values = psMetadataAlloc();
     466        psMetadataAddBool(values, PS_LIST_TAIL, "active", 0, "", false);
     467        long exps = psDBUpdateRows(config->dbh, "lapExp", where, values);
     468       
     469        if (exps) {
     470          return(true);
     471        }
     472        else {
     473          return(true); // We shouldn't really fail if we didn't change anything. Maybe there's nothing to change.
     474        }
    473475      }
    474476    }
Note: See TracChangeset for help on using the changeset viewer.