IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Feb 24, 2009, 12:00:25 PM (17 years ago)
Author:
Paul Price
Message:

Adding handling for missed exceptions, similar to register_imfile.pl --- the idea is to have exceptions trigger the my_die functions so that errors are recorded in the database, and don't go on forever.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ippScripts/scripts/detrend_resid_imfile.pl

    r19781 r22430  
    2222use Getopt::Long qw( GetOptions :config auto_help auto_version gnu_getopt );
    2323use Pod::Usage qw( pod2usage );
     24
     25# Look for programs we need
     26my $missing_tools;
     27my $dettool = can_run('dettool') or (warn "Can't find dettool" and $missing_tools = 1);
     28my $ppImage = can_run('ppImage') or (warn "Can't find ppImage" and $missing_tools = 1);
     29my $ppStats = can_run('ppStats') or (warn "Can't find ppStats" and $missing_tools = 1);
     30my $ppStatsFromMetadata = can_run('ppStatsFromMetadata') or (warn "Can't find ppStatsFromMetadata" and $missing_tools = 1);
     31if ($missing_tools) {
     32    warn("Can't find required tools.");
     33    exit($PS_EXIT_CONFIG_ERROR);
     34}
    2435
    2536my ( $det_id, $iter, $ref_det_id, $ref_iter, $exp_id, $exp_tag, $class_id, $det_type, $detrend, $input_uri, $camera, $mode, $outroot,
     
    6576    defined $detrend;
    6677
     78# Unhandled exceptions should be passed on to my_die so they get pushed into the database
     79$SIG{__DIE__} = sub { die @_ if $^S;
     80                      my_die( $_[0], $det_id, $iter, $exp_id, $class_id, $PS_EXIT_UNKNOWN_ERROR ); };
     81
    6782$ipprc->define_camera($camera);
    6883my $logDest     = $ipprc->filename("LOG.IMFILE", $outroot, $class_id);
     
    109124};
    110125
    111 # Look for programs we need
    112 my $missing_tools;
    113 my $dettool = can_run('dettool') or (warn "Can't find dettool" and $missing_tools = 1);
    114 my $ppImage = can_run('ppImage') or (warn "Can't find ppImage" and $missing_tools = 1);
    115 my $ppStats = can_run('ppStats') or (warn "Can't find ppStats" and $missing_tools = 1);
    116 my $ppStatsFromMetadata = can_run('ppStatsFromMetadata') or (warn "Can't find ppStatsFromMetadata" and $missing_tools = 1);
    117 if ($missing_tools) {
    118     warn("Can't find required tools.");
    119     exit($PS_EXIT_CONFIG_ERROR);
    120 }
    121 
    122126# outroot examples (HOST components must be set)
    123127# file://data/ipp004.0/gpc1/20080130
     
    179183    }
    180184    foreach my $line (@$stdout_buf) {
    181         $cmdflags .= " $line";
     185        $cmdflags .= " $line";
    182186    }
    183187    chomp $cmdflags;
     
    192196    }
    193197    foreach my $line (@$stdout_buf) {
    194         $cmdflags .= " $line";
     198        $cmdflags .= " $line";
    195199    }
    196200    chomp $cmdflags;
Note: See TracChangeset for help on using the changeset viewer.