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/magic_destreak.pl

    r21435 r22430  
    2626use Getopt::Long qw( GetOptions :config auto_help auto_version gnu_getopt );
    2727use Pod::Usage qw( pod2usage );
     28
     29# Look for programs we need
     30my $missing_tools;
     31my $magicdstool   = can_run('magicdstool') or (warn "Can't find magicdstool" and $missing_tools = 1);
     32my $streaksremove = can_run('streaksremove') or (warn "Can't find streaksremove" and $missing_tools = 1);
     33if ($missing_tools) {
     34    warn("Can't find required tools.");
     35    exit($PS_EXIT_CONFIG_ERROR);
     36}
    2837
    2938# Parse the command-line arguments
     
    6675    defined $component and
    6776    defined $outroot;
    68    
     77
     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], $magic_ds_id, $component, $PS_EXIT_UNKNOWN_ERROR ); };
     81
    6982
    7083my ($skycell_args, $class_id, $skycell_id);
     
    87100
    88101
    89 # Look for programs we need
    90 my $missing_tools;
    91 my $magicdstool   = can_run('magicdstool') or (warn "Can't find magicdstool" and $missing_tools = 1);
    92 my $streaksremove = can_run('streaksremove') or (warn "Can't find streaksremove" and $missing_tools = 1);
    93 if ($missing_tools) {
    94     warn("Can't find required tools.");
    95     exit($PS_EXIT_CONFIG_ERROR);
    96 }
    97 
    98102my $mdcParser = PS::IPP::Metadata::Config->new; # Parser for metadata config files
    99103
     
    128132    if (! -e $outroot ) {
    129133        my $code = system "mkdir -p $outroot";
    130         &my_die("cannot create output directory $outroot", $magic_ds_id, $component, 
     134        &my_die("cannot create output directory $outroot", $magic_ds_id, $component,
    131135                $code >> 8) if $code;
    132136    }
     
    143147        if (! -e $recoveryroot ) {
    144148            my $code = system "mkdir -p $recoveryroot";
    145             &my_die("cannot create output directory $outroot", $magic_ds_id, $component, 
     149            &my_die("cannot create output directory $outroot", $magic_ds_id, $component,
    146150                    $code >> 8) if $code;
    147151        }
     
    151155
    152156# get skycell list if needed
    153 my ($sfh, $skycell_list);         
     157my ($sfh, $skycell_list);
    154158if ($skycell_args) {
    155159    my $command = "$magicdstool -magic_ds_id $magic_ds_id -getskycells $skycell_args";
Note: See TracChangeset for help on using the changeset viewer.