IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 27643


Ignore:
Timestamp:
Apr 8, 2010, 6:48:58 PM (16 years ago)
Author:
watersc1
Message:

Better error handling. I think this largely concludes the bugtest phase of things. Now to integrate it.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/pstamp/scripts/detectability_respond.pl

    r27642 r27643  
    8181    run(command => $dqr_command, verbose => $verbose);
    8282unless ($success) {
    83     warn("Unable to perform $dqr_command error code: $error_code");
     83    my_die("Unable to perform $dqr_command error code: $error_code",-1,-1,-1,-1,-1,-1);
    8484}
    8585my %query = ();
     
    125125                                        $query{CONTENT}{RA1_DEG}[$i],$query{CONTENT}{DEC1_DEG}[$i],
    126126                                        $query{CONTENT}{ROWNUM}[$i],$verbose);
     127    unless (%$image_set_tmp) {
     128        my_die("No images were returned.",$query{HEADER}{QUERY_ID}[0],$query{HEADER}{FPA_ID}[0],
     129               $query{HEADER}{MJD_OBS}[0],$query{HEADER}{FILTER}[0],$query{HEADER}{OBSCODE}[0],
     130               $query{HEADER}{STAGE}[0]);
     131    }
    127132    print "=== $image_set_tmp->{IMAGE}\n    $image_set_tmp->{PSF}\n    $image_set_tmp->{MASK}\n    $image_set_tmp->{WEIGHT}\n    $image_set_tmp->{SKY_COORDINATES}\n    $image_set_tmp->{ROWNUM}\n";
    128133    # This appends, assuming that if we get an image, we also get the identical psf/mask/weight/etc.
     
    154159        run(command => $command, verbose => $verbose);
    155160    unless ($success) {
    156         warn("Unable to perform $command error code: $error_code");
     161        my_die("Unable to perform $command. Error_code: $error_code",
     162               $query{HEADER}{QUERY_ID}[0],$query{HEADER}{FPA_ID}[0],
     163               $query{HEADER}{MJD_OBS}[0],$query{HEADER}{FILTER}[0],$query{HEADER}{OBSCODE}[0],
     164               $query{HEADER}{STAGE}[0],$error_code);
    157165    }
    158166    my @response = split /\n/, (join "", @$stdout_buf);
     
    177185        run(command => $psphot_cmd, verbose => $verbose);
    178186    unless ($success) {
    179         warn ("Unable to perform $psphot_cmd error code: $error_code");
     187        my_die("Unable to perform $psphot_cmd. Error_code: $error_code",
     188               $query{HEADER}{QUERY_ID}[0],$query{HEADER}{FPA_ID}[0],
     189               $query{HEADER}{MJD_OBS}[0],$query{HEADER}{FILTER}[0],$query{HEADER}{OBSCODE}[0],
     190               $query{HEADER}{STAGE}[0],$error_code);
    180191    }
    181192}
     
    253264                # Diffs match if either exposure name is defined and matches the FPA_ID
    254265                unless ((defined(${ $j }{exp_name_1}) && (${ $j }{exp_name_1} eq $FPA_ID))||
    255                         (defined(${ $j }{exp_name_2}) && (${ $j }{exp_name_2} eq $FPA_ID))) {
     266                        (defined(${ $j }{exp_name_2}) && (${ $j }{exp_name_2} eq $FPA_ID))||
     267                        (${ $j }{exp_id_1} eq $FPA_ID)||(${ $j }{exp_id_2} eq $FPA_ID)) {
    256268                    next;
    257269                }
     
    268280                # For all the other stages (warp and chip are the ones I've tested), we can simply
    269281                # directly match the exposure name to the FPA_ID
    270                 if (${ $j }{exp_name} ne $FPA_ID) {
     282                unless ((${ $j }{exp_name} eq $FPA_ID)||(${ $j }{exp_id} eq $FPA_ID)) {
    271283                    next;
    272284                }
    273285            }
    274286            # Debug prints of all the components of this image
    275 #           foreach my $k (keys %{ $j }) {
    276 #               print "$i $j $k ${ $j }{$k}\n";
    277 #           }
     287            foreach my $k (keys %{ $j }) {
     288                print "$i $j $k ${ $j }{$k}\n";
     289            }
    278290           
    279291            # This image matches, so we want to save the information into our output structure
     
    499511    }
    500512}
     513
     514sub my_die {
     515    my $message = shift;
     516    my $QUERY_ID = shift;
     517    my $FPA_ID = shift;
     518    my $MJD_OBS = shift;
     519    my $FILTER = shift;
     520    my $OBSCODE = shift;
     521    my $STAGE = shift;
     522
     523    my $exit_code = shift;      # Exit code to add
     524
     525    $exit_code = $PS_EXIT_PROG_ERROR unless defined $exit_code;
     526
     527    carp("$message : $QUERY_ID $FPA_ID $MJD_OBS $FILTER $OBSCODE $STAGE");
     528    exit($exit_code);
     529
     530}
Note: See TracChangeset for help on using the changeset viewer.