IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 23186


Ignore:
Timestamp:
Mar 4, 2009, 4:17:15 PM (17 years ago)
Author:
Paul Price
Message:

Removing the exception handling I put in the other day. We suspect it's interfering with kapa falling over when the pipe is cut. Instead, being more careful with checking return status of PS::IPP::Config->new() and 6752ipprc->redirect_output(), combined with recent change to PS::IPP::Config should mean the former trouble of Perl scripts exiting without pushing exit status into the database should still be solved.

Location:
trunk/ippScripts/scripts
Files:
27 edited

Legend:

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

    r20100 r23186  
    5252my $caltool  = can_run('caltool')  or (warn "Can't find caltool"  and $missing_tools = 1);
    5353
    54 if ($missing_tools) { 
     54if ($missing_tools) {
    5555    warn ("Can't find required tools");
    56     exit($PS_EXIT_CONFIG_ERROR); 
     56    exit($PS_EXIT_CONFIG_ERROR);
    5757}
    5858
     
    7474        cache_run(command => $command, verbose => 1);
    7575
    76     unless ($success) { 
     76    unless ($success) {
    7777        $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
    7878        &my_die ("Unable to perform addstar -resort on region $region: $error_code", $cal_id, $region, "RESORT", $status, $dbname);
     
    8383{
    8484    foreach my $filter (@filters) {
    85         my $command = "$relphot $filter";
    86         $command .= "-D CATDIR $dvodb";
    87         $command .= "-region $RAs $RAe $DECs $DECe";
     85        my $command = "$relphot $filter";
     86        $command .= "-D CATDIR $dvodb";
     87        $command .= "-region $RAs $RAe $DECs $DECe";
    8888
    89         my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    90             cache_run(command => $command, verbose => 1);
     89        my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
     90            cache_run(command => $command, verbose => 1);
    9191
    92         unless ($success) {
    93             $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
    94             &my_die ("Unable to perform addstar -resort on region $region: $error_code", $cal_id, $region, "RELPHOT", $status, $dbname);
    95         }
     92        unless ($success) {
     93            $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
     94            &my_die ("Unable to perform addstar -resort on region $region: $error_code", $cal_id, $region, "RELPHOT", $status, $dbname);
     95        }
    9696    }
    9797}
     
    101101if (0) {
    102102    foreach my $filter (@filters) {
    103         my $command = "$uniphot $filter";
    104         $command .= "-D CATDIR $dvodb";
    105         $command .= "-region $RAs $RAe $DECs $DECe";
     103        my $command = "$uniphot $filter";
     104        $command .= "-D CATDIR $dvodb";
     105        $command .= "-region $RAs $RAe $DECs $DECe";
    106106
    107         my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    108             cache_run(command => $command, verbose => 1);
     107        my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
     108            cache_run(command => $command, verbose => 1);
    109109
    110         unless ($success) {
    111             $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
    112             &my_die ("Unable to perform addstar -resort on region $region: $error_code", $cal_id, $region, "UNIPHOT", $status, $dbname);
    113         }
     110        unless ($success) {
     111            $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
     112            &my_die ("Unable to perform addstar -resort on region $region: $error_code", $cal_id, $region, "UNIPHOT", $status, $dbname);
     113        }
    114114    }
    115115}
     
    121121
    122122    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    123         cache_run(command => $command, verbose => 1);
     123        cache_run(command => $command, verbose => 1);
    124124
    125     unless ($success) { 
    126         $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
    127         &my_die ("Unable to perform addstar -resort on region $region: $error_code", $cal_id, $region, "RELASTRO.OBJECTS", $status, $dbname);
     125    unless ($success) {
     126        $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
     127        &my_die ("Unable to perform addstar -resort on region $region: $error_code", $cal_id, $region, "RELASTRO.OBJECTS", $status, $dbname);
    128128    }
    129129}
     
    135135
    136136    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    137         cache_run(command => $command, verbose => 1);
     137        cache_run(command => $command, verbose => 1);
    138138
    139     unless ($success) { 
    140         $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
    141         &my_die ("Unable to perform addstar -resort on region $region: $error_code", $cal_id, $region, "RELASTRO.IMAGES", $status, $dbname);
     139    unless ($success) {
     140        $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
     141        &my_die ("Unable to perform addstar -resort on region $region: $error_code", $cal_id, $region, "RELASTRO.IMAGES", $status, $dbname);
    142142    }
    143143}
     
    169169    my $region    = shift;
    170170    my $last_step = shift;
    171     my $status    = shift;
    172     my $dbname    = shift;
     171    my $status    = shift;
     172    my $dbname    = shift;
    173173
    174174    carp($msg);
    175175    if (defined $cal_id && defined $region && defined $last_step && defined $status and not $no_update) {
    176176        my $command = "$caltool -addcalrun";
    177         $command .= " -cal_id $cal_id";
     177        $command .= " -cal_id $cal_id";
    178178        $command .= " -region $region";
    179         $command .= " -last_step $last_step";
    180         $command .= " -state $status";
     179        $command .= " -last_step $last_step";
     180        $command .= " -state $status";
    181181        $command .= " -dbname $dbname" if defined $dbname;
    182182        system ($command);
  • trunk/ippScripts/scripts/camera_exp.pl

    r22430 r23186  
    2222use PS::IPP::Config 1.01 qw( :standard );
    2323use File::Temp qw( tempfile );
    24 
    25 my $ipprc = PS::IPP::Config->new(); # IPP configuration
    2624
    2725use Getopt::Long qw( GetOptions :config auto_help auto_version gnu_getopt );
     
    7068    defined $camera;
    7169
    72 # Unhandled exceptions should be passed on to my_die so they get pushed into the database
    73 $SIG{__DIE__} = sub { die @_ if $^S;
    74                       my_die( $_[0], $cam_id, $PS_EXIT_UNKNOWN_ERROR ); };
    75 
    76 $ipprc->define_camera($camera);
     70my $ipprc = PS::IPP::Config->new( $camera ) or my_die( "Unable to set up", $cam_id, $PS_EXIT_CONFIG_ERROR ); # IPP configuration
    7771
    7872my $logDest = $ipprc->filename("LOG.EXP", $outroot) or &my_die("Missing entry from camera config", $cam_id, $PS_EXIT_CONFIG_ERROR);
     
    8478
    8579if ($redirect) {
    86     $ipprc->redirect_output($logDest);
     80    $ipprc->redirect_output($logDest) or my_die( "Unable to redirect output", $cam_id, $PS_EXIT_SYS_ERROR );
    8781    print "\n\n";
    8882    print "Starting script $0 on $host\n\n";
  • trunk/ippScripts/scripts/chip_imfile.pl

    r22430 r23186  
    2020use PS::IPP::Metadata::Config;
    2121use PS::IPP::Config 1.01 qw( :standard );
    22 
    23 my $ipprc = PS::IPP::Config->new(); # IPP configuration
    2422
    2523use Getopt::Long qw( GetOptions :config auto_help auto_version gnu_getopt );
     
    7068    defined $run_state;
    7169
    72 # Unhandled exceptions should be passed on to my_die so they get pushed into the database
    73 $SIG{__DIE__} = sub { die @_ if $^S;
    74                       my_die( $_[0], $exp_id, $chip_id, $class_id, $PS_EXIT_UNKNOWN_ERROR ); };
    75 
    76 $ipprc->define_camera($camera);
     70my $ipprc = PS::IPP::Config->new( $camera ) or my_die( "Unable to set up", $exp_id, $chip_id, $class_id, $PS_EXIT_CONFIG_ERROR ); # IPP configuration
    7771
    7872my $logDest = $ipprc->filename("LOG.IMFILE", $outroot, $class_id) or &my_die("Missing entry from camera config", $exp_id, $chip_id, $class_id, $PS_EXIT_CONFIG_ERROR);
     
    8074
    8175if ($redirect) {
    82     $ipprc->redirect_output($logDest);
     76    $ipprc->redirect_output($logDest) or my_die( "Unable to redirect output", $exp_id, $chip_id, $class_id, $PS_EXIT_SYS_ERROR );
    8377    print STDOUT "\n\n";
    8478    print STDOUT "Starting script $0 on $host\n\n";
  • trunk/ippScripts/scripts/detrend_correct_imfile.pl

    r22430 r23186  
    1818use PS::IPP::Metadata::Config;
    1919use PS::IPP::Config 1.01 qw( :standard );
    20 
    21 my $ipprc = PS::IPP::Config->new(); # IPP configuration
    2220
    2321use Getopt::Long qw( GetOptions :config auto_help auto_version gnu_getopt );
     
    6058    and defined $camera;
    6159
    62 # Unhandled exceptions should be passed on to my_die so they get pushed into the database
    63 $SIG{__DIE__} = sub { die @_ if $^S;
    64                       my_die( $_[0], $det_id, $class_id, $PS_EXIT_UNKNOWN_ERROR ); };
    65 
    66 # XXX this exits with status = 0 on failure
    67 $ipprc->define_camera($camera);
    68 
     60my $ipprc = PS::IPP::Config->new( $camera ) or my_die( "Unable to set up", $det_id, $class_id, $PS_EXIT_CONFIG_ERROR ); # IPP configuration
    6961if ($redirect) {
    7062    my $logDest = $ipprc->filename("LOG.IMFILE", $outroot, $class_id)
    7163       or &my_die("Missing entry from camera config", $det_id, $class_id, $PS_EXIT_CONFIG_ERROR);
    72     $ipprc->redirect_output($logDest);
     64    $ipprc->redirect_output($logDest) or my_die( "Unable to redirect output", $det_id, $class_id, $PS_EXIT_SYS_ERROR );
    7365}
    7466
  • trunk/ippScripts/scripts/detrend_norm_apply.pl

    r22430 r23186  
    1717use PS::IPP::Metadata::Config;
    1818use PS::IPP::Config 1.01 qw( :standard );
    19 
    20 my $ipprc = PS::IPP::Config->new(); # IPP configuration
    2119
    2220use Getopt::Long qw( GetOptions :config auto_help auto_version gnu_getopt );
     
    6462    defined $outroot;
    6563
    66 # Unhandled exceptions should be passed on to my_die so they get pushed into the database
    67 $SIG{__DIE__} = sub { die @_ if $^S;
    68                       my_die( $_[0], $det_id, $iter, $class_id, $PS_EXIT_UNKNOWN_ERROR ); };
    69 
    70 $ipprc->define_camera($camera);
     64my $ipprc = PS::IPP::Config->new( $camera ) or my_die( "Unable to set up", $det_id, $iter, $class_id, $PS_EXIT_CONFIG_ERROR ); # IPP configuration
    7165
    7266my $logDest = $ipprc->filename("LOG.IMFILE", $outroot, $class_id)
    7367        or &my_die("Missing entry from camera config", $det_id, $iter, $class_id, $PS_EXIT_CONFIG_ERROR);
    74 $ipprc->redirect_output($logDest) if $redirect;
     68$ipprc->redirect_output($logDest) or my_die( "Unable to redirect output", $det_id, $iter, $class_id, $PS_EXIT_SYS_ERROR ) if $redirect;
    7569
    7670my $RECIPE_PPIMAGE = 'PPIMAGE_N'; # Recipe to use with ppImage
  • trunk/ippScripts/scripts/detrend_norm_calc.pl

    r22430 r23186  
    1919use PS::IPP::Metadata::List qw( parse_md_list );
    2020use PS::IPP::Config 1.01 qw( :standard );
    21 
    22 my $ipprc = PS::IPP::Config->new(); # IPP configuration
    2321
    2422use Getopt::Long qw( GetOptions :config auto_help auto_version gnu_getopt );
     
    5755    defined $outroot;
    5856
    59 # Unhandled exceptions should be passed on to my_die so they get pushed into the database
    60 $SIG{__DIE__} = sub { die @_ if $^S;
    61                       my_die( $_[0], $det_id, $iter, $PS_EXIT_UNKNOWN_ERROR ); };
     57my $ipprc = PS::IPP::Config->new() or my_die( "Unable to set up", $det_id, $iter, $PS_EXIT_CONFIG_ERROR ); # IPP configuration
    6258
    6359my $logfile = $outroot . ".log";
    64 
    65 $ipprc->redirect_output($logfile) if $redirect;
     60$ipprc->redirect_output($logfile) or my_die( "Unable to redirect output", $det_id, $iter, $PS_EXIT_SYS_ERROR ) if $redirect;
    6661
    6762use constant STATISTIC => 'bg'; # Background statistic to use from the database
  • trunk/ippScripts/scripts/detrend_norm_exp.pl

    r22430 r23186  
    1919use PS::IPP::Metadata::List qw( parse_md_list );
    2020use File::Temp qw( tempfile );
    21 
    22 my $ipprc = PS::IPP::Config->new(); # IPP configuration
    2321
    2422use Getopt::Long qw( GetOptions :config auto_help auto_version gnu_getopt );
     
    6058    defined $outroot;
    6159
    62 # Unhandled exceptions should be passed on to my_die so they get pushed into the database
    63 $SIG{__DIE__} = sub { die @_ if $^S;
    64                       my_die( $_[0], $det_id, $iter, $PS_EXIT_UNKNOWN_ERROR ); };
    65 
     60my $ipprc = PS::IPP::Config->new( $camera ) or my_die( "Unable to set up", $det_id, $iter, $PS_EXIT_CONFIG_ERROR ); # IPP configuration
    6661my $logfile = $outroot . ".log";
    67 
    68 $ipprc->redirect_output($logfile) if $redirect;
    69 
    70 $ipprc->define_camera($camera);
     62$ipprc->redirect_output($logfile) or my_die( "Unable to redirect output", $det_id, $iter, $PS_EXIT_SYS_ERROR ) if $redirect;
    7163
    7264# Recipes to use based on reduction class
  • trunk/ippScripts/scripts/detrend_process_exp.pl

    r22430 r23186  
    1919use PS::IPP::Metadata::List qw( parse_md_list );
    2020use File::Temp qw( tempfile );
    21 
    22 my $ipprc = PS::IPP::Config->new(); # IPP configuration
    2321
    2422use Getopt::Long qw( GetOptions :config auto_help auto_version gnu_getopt );
     
    6361    defined $outroot;
    6462
    65 # Unhandled exceptions should be passed on to my_die so they get pushed into the database
    66 $SIG{__DIE__} = sub { die @_ if $^S;
    67                       my_die( $_[0], $det_id, $exp_id, $PS_EXIT_UNKNOWN_ERROR ); };
    68 
    69 $ipprc->define_camera($camera);
    70 
     63my $ipprc = PS::IPP::Config->new( $camera ) or my_die( "Unable to set up", $det_id, $exp_id, $PS_EXIT_CONFIG_ERROR ); # IPP configuration
    7164if ($redirect) {
    7265    my $logDest = $ipprc->filename("LOG.EXP", $outroot, "NONE")
    7366        or &my_die("Missing entry in file rules", $det_id, $exp_id, $PS_EXIT_CONFIG_ERROR);
    74     $ipprc->redirect_output($logDest);
     67    $ipprc->redirect_output($logDest) or my_die( "Unable to redirect output", $det_id, $exp_id, $PS_EXIT_SYS_ERROR );
    7568}
    7669
  • trunk/ippScripts/scripts/detrend_process_imfile.pl

    r23183 r23186  
    1717use PS::IPP::Metadata::Config;
    1818use PS::IPP::Config 1.01 qw( :standard );
    19 
    20 my $ipprc = PS::IPP::Config->new(); # IPP configuration
    2119
    2220use Getopt::Long qw( GetOptions :config auto_help auto_version gnu_getopt );
     
    6563    defined $outroot;
    6664
    67 # Unhandled exceptions should be passed on to my_die so they get pushed into the database
    68 $SIG{__DIE__} = sub { die @_ if $^S;
    69                       my_die( $_[0], $det_id, $exp_id, $class_id, $PS_EXIT_UNKNOWN_ERROR ); };
    70 
    71 # XXX this exits with status = 0 on failure
    72 $ipprc->define_camera($camera);
    73 
     65my $ipprc = PS::IPP::Config->new( $camera ) or my_die( "Unable to set up", $det_id, $exp_id, $class_id, $PS_EXIT_CONFIG_ERROR ); # IPP configuration
    7466my $logDest = $ipprc->filename("LOG.IMFILE", $outroot, $class_id) or &my_die("Missing entry from camera config", $det_id, $exp_id, $class_id, $PS_EXIT_CONFIG_ERROR);
    75 
    76 $ipprc->redirect_output($logDest) if $redirect;
     67$ipprc->redirect_output($logDest) or my_die( "Unable to redirect output", $det_id, $exp_id, $class_id, $PS_EXIT_SYS_ERROR ) if $redirect;
    7768
    7869# Recipes to use as a function of detrend type
     
    113104my $cmdflags;
    114105
    115 my $outputImage = $ipprc->filename("PPIMAGE.OUTPUT", $outroot, $class_id) or &my_die("Missing entry from camera config", $det_id, $exp_id, $class_id, $PS_EXIT_PROG_ERROR);
     106my $filerule = $FILERULES->{$det_type}; # File rule to use for output
     107$filerule =  "PPIMAGE.OUTPUT" unless defined $filerule;
     108
     109my $outputImage = $ipprc->filename($filerule,        $outroot, $class_id) or &my_die("Missing entry from camera config", $det_id, $exp_id, $class_id, $PS_EXIT_PROG_ERROR);
    116110my $outputBin1  = $ipprc->filename("PPIMAGE.BIN1",   $outroot, $class_id) or &my_die("Missing entry from camera config", $det_id, $exp_id, $class_id, $PS_EXIT_PROG_ERROR);
    117111my $outputBin2  = $ipprc->filename("PPIMAGE.BIN2",   $outroot, $class_id) or &my_die("Missing entry from camera config", $det_id, $exp_id, $class_id, $PS_EXIT_PROG_ERROR);
    118112my $outputStats = $ipprc->filename("PPIMAGE.STATS",  $outroot, $class_id) or &my_die("Missing entry from camera config", $det_id, $exp_id, $class_id, $PS_EXIT_PROG_ERROR);
    119113my $traceDest   = $ipprc->filename("TRACE.IMFILE",   $outroot, $class_id) or &my_die("Missing entry from camera config", $exp_id, $exp_id, $class_id, $PS_EXIT_CONFIG_ERROR);
     114
     115
    120116# Run ppImage
    121117unless ($no_op) {
     
    125121    $command .= " -recipe PPSTATS DETSTATS";
    126122    $command .= " -stats $outputStats";
    127     $command .= " -F PPIMAGE.OUTPUT $FILERULES{$det_type}" if defined $FILERULES{$det_type};
    128 
     123    $command .= " -F PPIMAGE.OUTPUT $filerule" if $filerule ne "PPIMAGE.OUTPUT";
    129124    $command .= " -tracedest $traceDest -log $logDest";
    130125    $command .= " -threads $threads" if defined $threads;
  • trunk/ippScripts/scripts/detrend_reject_exp.pl

    r22430 r23186  
    2020use PS::IPP::Metadata::List qw( parse_md_list );
    2121use Statistics::Descriptive;
    22 
    23 my $ipprc = PS::IPP::Config->new(); # IPP configuration
    2422
    2523my $ITER_LIMIT = 20;
     
    6058    defined $outroot;
    6159
    62 # Unhandled exceptions should be passed on to my_die so they get pushed into the database
    63 $SIG{__DIE__} = sub { die @_ if $^S;
    64                       my_die( $_[0], $det_id, $iter, $PS_EXIT_UNKNOWN_ERROR ); };
    65 
    66 # check for existing directory, generate if needed
    67 $ipprc->outroot_prepare($outroot);
    68 
     60my $ipprc = PS::IPP::Config->new() or my_die( "Unable to set up", $det_id, $iter, $PS_EXIT_CONFIG_ERROR ); # IPP configuration
     61$ipprc->outroot_prepare($outroot) or my_die( "Unable to prepare output root", $det_id, $iter, $PS_EXIT_SYS_ERROR );
    6962my $logName = "$outroot.log"; # Name for log
    70 
    71 $ipprc->redirect_output($logName) if $redirect;
     63$ipprc->redirect_output($logName) or my_die( "Unable to redirect", $det_id, $iter, $PS_EXIT_SYS_ERROR ) if $redirect;
    7264
    7365# values to extract from output metadata and the stats to calculate
  • trunk/ippScripts/scripts/detrend_resid_exp.pl

    r22430 r23186  
    3030use File::Temp qw( tempfile );                   # tools to construct temp files
    3131use PS::IPP::Config 1.01 qw( :standard );
    32 
    33 my $ipprc = PS::IPP::Config->new(); # IPP configuration
    3432
    3533use Getopt::Long qw( GetOptions :config auto_help auto_version gnu_getopt ); # option parsing
     
    7977    defined $outroot;
    8078
    81 # Unhandled exceptions should be passed on to my_die so they get pushed into the database
    82 $SIG{__DIE__} = sub { die @_ if $^S;
    83                       my_die( $_[0], $det_id, $iter, $exp_id, $PS_EXIT_UNKNOWN_ERROR ); };
    84 
    8579# load IPP config information for the specified camera
    86 $ipprc->define_camera($camera);
    87 
     80my $ipprc = PS::IPP::Config->new( $camera ) or my_die( "Unable to set up", $det_id, $iter, $exp_id, $PS_EXIT_CONFIG_ERROR ); # IPP configuration
    8881my $logDest = $ipprc->filename("LOG.EXP", $outroot) or &my_die("Missing entry from camera config", $det_id, $iter, $exp_id, $PS_EXIT_CONFIG_ERROR);
    89 
    90 $ipprc->redirect_output($logDest) if $redirect;
     82$ipprc->redirect_output($logDest) or my_die( "Unable to redirect output", $det_id, $iter, $exp_id, $PS_EXIT_SYS_ERROR ) if $redirect;
    9183
    9284# Recipes to use based on reduction class
  • trunk/ippScripts/scripts/detrend_resid_imfile.pl

    r23183 r23186  
    1717use PS::IPP::Metadata::Config;
    1818use PS::IPP::Config 1.01 qw( :standard );
    19 
    20 my $ipprc = PS::IPP::Config->new(); # IPP configuration
    2119
    2220use Getopt::Long qw( GetOptions :config auto_help auto_version gnu_getopt );
     
    7674    defined $detrend;
    7775
    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 
    82 $ipprc->define_camera($camera);
    83 my $logDest     = $ipprc->filename("LOG.IMFILE", $outroot, $class_id);
    84 if ($redirect) {
    85     $ipprc->redirect_output($logDest);
    86 }
     76my $ipprc = PS::IPP::Config->new( $camera ) or my_die( "Unable to set up", $det_id, $iter, $exp_id, $class_id, $PS_EXIT_CONFIG_ERROR ); # IPP configuration
     77my $logDest = $ipprc->filename("LOG.IMFILE", $outroot, $class_id) or my_die( "Unable to find LOG.IMFILE", $det_id, $iter, $exp_id, $class_id, $PS_EXIT_CONFIG_ERROR );
     78$ipprc->redirect_output($logDest) or my_die( "Unable to find LOG.IMFILE", $det_id, $iter, $exp_id, $class_id, $PS_EXIT_SYS_ERROR ) if $redirect;
    8779
    8880# Recipes to use as a function of detrend type and mode
     
    155147# my $outputName  = $ipprc->filename("PPIMAGE.OUTPUT", $outroot, $class_id);
    156148
    157 my $outputName  = $ipprc->filename("PPIMAGE.OUTPUT.RESID", $outroot, $class_id);
     149my $filerule = $FILERULES->{$det_type}; # File rule to use
     150
     151my $outputName  = $ipprc->filename($filerule,        $outroot, $class_id);
    158152my $bin1Name    = $ipprc->filename("PPIMAGE.BIN1",   $outroot, $class_id);
    159153my $bin2Name    = $ipprc->filename("PPIMAGE.BIN2",   $outroot, $class_id);
     
    169163    $command .= " -recipe JPEG $jpeg_recipe";
    170164    $command .= " -recipe PPSTATS RESIDUAL";
    171     $command .= " -F PPIMAGE.OUTPUT $FILERULES{$det_type}" if defined $FILERULES{$det_type};
     165    $command .= " -F PPIMAGE.OUTPUT $filerule";
    172166    $command .= " -stats $outputStats";
    173167    $command .= " -tracedest $traceDest -log $logDest";
  • trunk/ippScripts/scripts/detrend_stack.pl

    r22430 r23186  
    1818use PS::IPP::Metadata::List qw( parse_md_list );
    1919use PS::IPP::Config 1.01 qw( :standard );
    20 
    21 my $ipprc = PS::IPP::Config->new(); # IPP configuration
    2220
    2321use Getopt::Long qw( GetOptions :config auto_help auto_version gnu_getopt );
     
    6361    defined $outroot;
    6462
    65 $ipprc->define_camera($camera);
    6663$det_type = uc($det_type);
    6764
     65my $ipprc = PS::IPP::Config->new( $camera ) or my_die( "Unable to set up", $det_id, $iter, $class_id, $PS_EXIT_CONFIG_ERROR ); # IPP configuration
    6866my $logDest = $ipprc->filename("LOG.IMFILE", $outroot, $class_id)
    6967    or &my_die("Missing entry in file rules", $det_id, $iter, $class_id, $PS_EXIT_CONFIG_ERROR);
    70 
    71 # Unhandled exceptions should be passed on to my_die so they get pushed into the database
    72 $SIG{__DIE__} = sub { die @_ if $^S;
    73                       my_die( $_[0], $det_id, $iter, $class_id, $PS_EXIT_UNKNOWN_ERROR ); };
    74 
    75 # optionally redirect the outputs from this script to LOG.IMFILE
    76 $ipprc->redirect_output($logDest) if $redirect;
     68$ipprc->redirect_output($logDest) or my_die( "Unable to redirect output", $det_id, $iter, $class_id, $PS_EXIT_SYS_ERROR ) if $redirect;
    7769
    7870# Recipes to use as a function of detrend type
  • trunk/ippScripts/scripts/diff_skycell.pl

    r22433 r23186  
    2121use Data::Dumper;
    2222use PS::IPP::Config 1.01 qw( :standard );
    23 
    24 my $ipprc = PS::IPP::Config->new(); # IPP configuration
    2523
    2624use Getopt::Long qw( GetOptions :config auto_help auto_version gnu_getopt );
     
    6260    and defined $outroot;
    6361
    64 # Unhandled exceptions should be passed on to my_die so they get pushed into the database
    65 $SIG{__DIE__} = sub { die @_ if $^S;
    66                       my_die( $_[0], $diff_id, $skycell_id, $PS_EXIT_UNKNOWN_ERROR ); };
     62my $ipprc = PS::IPP::Config->new() or my_die( "Unable to set up", $diff_id, $skycell_id, $PS_EXIT_CONFIG_ERROR ); # IPP configuration
    6763
    6864# XXX camera is not known here; cannot use filerules...
    6965# my $logDest = $ipprc->filename("LOG.EXP", $outroot);
    7066my $logDest = "$outroot.log";
    71 $ipprc->redirect_output($logDest) if $redirect;
     67$ipprc->redirect_output($logDest) or my_die( "Unable to redirect output", $diff_id, $skycell_id, $PS_EXIT_SYS_ERROR ) if $redirect;
    7268
    7369my $source_id = $ipprc->source_id($dbname, $PS_TABLE_ID_DIFF);
  • trunk/ippScripts/scripts/fake_imfile.pl

    r22430 r23186  
    3636use PS::IPP::Metadata::Config;
    3737use PS::IPP::Config 1.01 qw( :standard );
    38 
    39 my $ipprc = PS::IPP::Config->new(); # IPP configuration
    4038
    4139use Getopt::Long qw( GetOptions :config auto_help auto_version gnu_getopt );
     
    8280    defined $outroot;
    8381
    84 # Unhandled exceptions should be passed on to my_die so they get pushed into the database
    85 $SIG{__DIE__} = sub { die @_ if $^S;
    86                       my_die( $_[0], $exp_id, $fake_id, $class_id, $PS_EXIT_UNKNOWN_ERROR ); };
    87 
    88 $ipprc->define_camera($camera);
    89 
    90 my $logDest = $ipprc->filename("LOG.IMFILE", $outroot, $class_id)  or &my_die("Missing entry from camera config", $exp_id, $fake_id, $class_id, $PS_EXIT_CONFIG_ERROR);
    91 
    92 $ipprc->redirect_output($logDest) if $redirect;
     82my $ipprc = PS::IPP::Config->new( $camera ) or my_die( "Unable to set up", $exp_id, $fake_id, $class_id, $PS_EXIT_CONFIG_ERROR ); # IPP configuration
     83my $logDest = $ipprc->filename("LOG.IMFILE", $outroot, $class_id) or &my_die("Missing entry from camera config", $exp_id, $fake_id, $class_id, $PS_EXIT_CONFIG_ERROR);
     84$ipprc->redirect_output($logDest) or my_die( "Unable to redirect output", $exp_id, $fake_id, $class_id, $PS_EXIT_SYS_ERROR ) if $redirect;
    9385
    9486# Recipes to use based on reduction class
  • trunk/ippScripts/scripts/ipp_cleanup.pl

    r22750 r23186  
    1818use Pod::Usage qw( pod2usage );
    1919
    20 my $ipprc = PS::IPP::Config->new(); # this is used for PATH, NEB filename conversions
    21 
    2220# Parse the command-line arguments
    2321my ($stage, $camera, $stage_id, $mode, $path_base, $dbname, $verbose, $no_op, $helplist);
    2422GetOptions('stage=s'        => \$stage,     # which analysis stage to clean?
    25            'camera|i=s'     => \$camera,    # user-supplied camera name
    26            'stage_id=s'     => \$stage_id,  # id for this stage (only needed for certain stages)
    27            'mode|m=s'       => \$mode,      # cleanup mode (clean / purge)
    28            'path_base=s'    => \$path_base, # basename for files
    29            'dbname|d=s'     => \$dbname,    # Database name
     23           'camera|i=s'     => \$camera,    # user-supplied camera name
     24           'stage_id=s'     => \$stage_id,  # id for this stage (only needed for certain stages)
     25           'mode|m=s'       => \$mode,      # cleanup mode (clean / purge)
     26           'path_base=s'    => \$path_base, # basename for files
     27           'dbname|d=s'     => \$dbname,    # Database name
    3028           'verbose'        => \$verbose,   # Print to stdout
    31            'no-op'          => \$no_op,     # pretend but don't actually inject
    32            'helplist'       => \$helplist   # give help listing
    33            ) or pod2usage( 2 );
    34 
    35 pod2usage( -msg => "remove temporary / all data files for an IPP analysis stage", 
    36            -exitval => 2) if defined $helplist;
    37 
    38 pod2usage( -msg => "Usage: $0 --camera (name) --stage (stage) --stage_id (stage_id) --mode (mode) [--path_base (path)] [--dbname dbname] [--no-op] [--help]", 
    39            -exitval => 2 ) if scalar @ARGV;
     29           'no-op'          => \$no_op,     # pretend but don't actually inject
     30           'helplist'       => \$helplist   # give help listing
     31           ) or pod2usage( 2 );
     32
     33pod2usage( -msg => "remove temporary / all data files for an IPP analysis stage",
     34           -exitval => 2) if defined $helplist;
     35
     36pod2usage( -msg => "Usage: $0 --camera (name) --stage (stage) --stage_id (stage_id) --mode (mode) [--path_base (path)] [--dbname dbname] [--no-op] [--help]",
     37           -exitval => 2 ) if scalar @ARGV;
    4038
    4139pod2usage( -msg => "Required options:--camera (name) --stage (stage) --mode (mode)",
    42            -exitval => 3) unless
     40           -exitval => 3) unless
    4341    defined $camera and
    4442    defined $stage and
    4543    defined $mode;
    4644
     45my $ipprc = PS::IPP::Config->new( $camera ) or my_die("Unable to set up", $stage_id, $PS_EXIT_CONFIG_ERROR); # this is used for PATH, NEB filename conversions
     46
    4747# $mode must be one of "goto_cleaned", "goto_scrubbed", or "goto_purged"
    48 # goto_cleaned and goto_scrubbed both result in 'cleaned': scrubbed allows chips without config files to 
     48# goto_cleaned and goto_scrubbed both result in 'cleaned': scrubbed allows chips without config files to
    4949# be cleaned (they cannot be recovered, but the small data is left behind)
    5050unless (($mode eq "goto_cleaned") || ($mode eq "goto_scrubbed") || ($mode eq "goto_purged")) {
    51     die "invalid cleanup mode $mode\n";   
     51    die "invalid cleanup mode $mode\n";
    5252}
    5353
     
    5757}
    5858
    59 $ipprc->define_camera($camera);
    60 
    6159my $mdcParser = PS::IPP::Metadata::Config->new; # Parser for metadata config files
    6260
    6361# choice of files to delete depends on the stage
    6462if ($stage eq "chip") {
    65    
     63
    6664    die "--stage_id required for stage chip\n" if !$stage_id;
    6765    ### select the imfiles for this entry
     
    8987    # loop over all of the imfiles, determine the path_base and class_id for each
    9088    foreach my $imfile (@$imfiles) {
    91         my $class_id = $imfile->{class_id};
    92         my $path_base = $imfile->{path_base};
     89        my $class_id = $imfile->{class_id};
     90        my $path_base = $imfile->{path_base};
    9391        my $status = 1;
    9492
    9593        # don't clean up unless the data needed to update is available
    96         # modes goto_purged and goto_scrubbed will remove files even if the config is non-existent
     94        # modes goto_purged and goto_scrubbed will remove files even if the config is non-existent
    9795        if ($mode eq "goto_cleaned") {
    9896            my $config_file = $ipprc->filename("PPIMAGE.CONFIG", $path_base, $class_id);
     
    127125                addFilename (\@files, "PPIMAGE.CONFIG", $path_base, $class_id);
    128126            }
    129        
     127
    130128            # actual command to delete the files
    131129            $status = &delete_files (\@files);
    132130        }
    133131
    134         if ($status)  {
    135             my $command = "$chiptool -chip_id $stage_id -class_id $class_id";
     132        if ($status)  {
     133            my $command = "$chiptool -chip_id $stage_id -class_id $class_id";
    136134            if ($mode eq "goto_purged") {
    137135                $command .= " -topurgedimfile";
    138136            } elsif ($mode eq "goto_scrubbed") {
    139137                $command .= " -tocleanedimfile_from_scrubbed";
    140             } else {
     138            } else {
    141139                $command .= " -tocleanedimfile";
    142140            }
    143             $command .= " -dbname $dbname" if defined $dbname;
    144 
    145             my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
     141            $command .= " -dbname $dbname" if defined $dbname;
     142
     143            my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    146144                    run(command => $command, verbose => $verbose);
    147             unless ($success) {
    148                 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
    149                 &my_die("Unable to perform chiptool: $error_code", "chip", $stage_id, $error_code);
    150             }
     145            unless ($success) {
     146                $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
     147                &my_die("Unable to perform chiptool: $error_code", "chip", $stage_id, $error_code);
     148            }
    151149        } else {
    152             # if an error happens for one chip, the chipRun will stay in goto_*, but the chips will stop be run
    153             my $command = "$chiptool -updateprocessedimfile -chip_id $stage_id -class_id $class_id -code 1";
    154             $command .= " -dbname $dbname" if defined $dbname;
    155 
    156             my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
     150            # if an error happens for one chip, the chipRun will stay in goto_*, but the chips will stop be run
     151            my $command = "$chiptool -updateprocessedimfile -chip_id $stage_id -class_id $class_id -code 1";
     152            $command .= " -dbname $dbname" if defined $dbname;
     153
     154            my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    157155                    run(command => $command, verbose => $verbose);
    158             unless ($success) {
    159                 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
    160                 &my_die("Unable to perform chiptool: $error_code", "chip", $stage_id, $error_code);
    161             }
    162         }
     156            unless ($success) {
     157                $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
     158                &my_die("Unable to perform chiptool: $error_code", "chip", $stage_id, $error_code);
     159            }
     160        }
    163161    }
    164162    exit 0;
    165 } 
     163}
    166164
    167165if ($stage eq "camera") {
     
    244242    }
    245243    exit 0;
    246 } 
     244}
    247245
    248246if ($stage eq "warp") {
     
    305303        }
    306304
    307         if ($status)  {
    308             my $command = "$warptool -warp_id $stage_id -skycell_id $skycell_id";
     305        if ($status)  {
     306            my $command = "$warptool -warp_id $stage_id -skycell_id $skycell_id";
    309307            if ($mode eq "goto_purged") {
    310308                $command .= " -topurgedskyfile";
     
    312310                $command .= " -tocleanedskyfile";
    313311            }
    314             $command .= " -dbname $dbname" if defined $dbname;
    315 
    316             my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
     312            $command .= " -dbname $dbname" if defined $dbname;
     313
     314            my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    317315                    run(command => $command, verbose => $verbose);
    318             unless ($success) {
    319                 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
    320                 &my_die("Unable to perform warptool: $error_code", "warp", $stage_id, $error_code);
    321             }
     316            unless ($success) {
     317                $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
     318                &my_die("Unable to perform warptool: $error_code", "warp", $stage_id, $error_code);
     319            }
    322320         } else {
    323321            # XXX: -updateskyfile mode does not exist, need to add it
    324             my $command = "$warptool -updateskyfile -warp_id $stage_id -skycell_id $skycell_id -code 1";
    325             $command .= " -dbname $dbname" if defined $dbname;
     322            my $command = "$warptool -updateskyfile -warp_id $stage_id -skycell_id $skycell_id -code 1";
     323            $command .= " -dbname $dbname" if defined $dbname;
    326324
    327325            my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    328326                run(command => $command, verbose => $verbose);
    329             unless ($success) {
    330                 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
    331                 &my_die("Unable to perform warptool: $error_code", "warp", $stage_id, $error_code);
    332             }
     327            unless ($success) {
     328                $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
     329                &my_die("Unable to perform warptool: $error_code", "warp", $stage_id, $error_code);
     330            }
    333331            exit $PS_EXIT_UNKNOWN_ERROR;
    334         }
     332        }
    335333    }
    336334    exit 0;
     
    344342die "ipp_cleanup.pl -stage $stage not yet implemented\n";
    345343
    346 sub delete_files 
     344sub delete_files
    347345{
    348346    my $files = shift; # reference to a list of files to unlink
    349    
    350     # this script is, of course, very dangerous. 
     347
     348    # this script is, of course, very dangerous.
    351349    foreach my $file (@$files) {
    352         print STDERR "unlinking $file\n";
     350        print STDERR "unlinking $file\n";
    353351        $ipprc->file_delete($file);
    354352    }
     
    356354}
    357355
    358 sub addFilename 
     356sub addFilename
    359357{
    360358    my $files      = shift; # reference to a list of files to unlink
  • trunk/ippScripts/scripts/ipp_maskscript.pl

    r17671 r23186  
    1212use PS::IPP::Config 1.01 qw( :standard );
    1313
    14 my $ipprc = PS::IPP::Config->new(); # IPP configuration
    15 
    1614my ($dbname, $det_id, $camera);
    17 
    1815GetOptions('dbname=s'    => \$dbname,
    19            'det_id=s'    => \$det_id,
    20            'camera|c=s'  => \$camera,
    21            ) or pod2usage( 2 );
     16           'det_id=s'    => \$det_id,
     17           'camera|c=s'  => \$camera,
     18           ) or pod2usage( 2 );
    2219
    2320pod2usage( -msg => "Unknown option: @ARGV", -exitval => 2 ) if @ARGV;
    2421
    2522pod2usage(
    26           -msg => "USAGE: ipp_maskscript.pl --dbname (name) --det_id (id) --iter (iteration) --camera (name)",
    27           -exitval => 3,
    28           ) unless defined $dbname and defined $det_id and defined $camera;
     23          -msg => "USAGE: ipp_maskscript.pl --dbname (name) --det_id (id) --iter (iteration) --camera (name)",
     24          -exitval => 3,
     25          ) unless defined $dbname and defined $det_id and defined $camera;
    2926
    3027# I could determine the camera from a query for the detrun
    31 $ipprc->define_camera($camera);
     28my $ipprc = PS::IPP::Config->new( $camera ) or my_die("Unable to setup", $PS_EXIT_CONFIG_ERROR); # IPP configuration
    3229
    3330###  Get list of dark imfile results
     
    4744
    4845# parse the output into a list
    49 my $mdcParser = PS::IPP::Metadata::Config->new; # Parser for metadata config files
     46my $mdcParser = PS::IPP::Metadata::Config->new; # Parser for metadata config files
    5047my $metadata = $mdcParser->parse(join "", @$stdout_buf) or
    5148    &my_die("Unable to parse metadata config doc", $PS_EXIT_PROG_ERROR);
     
    8178    # print STDERR "contents: @contents\n";
    8279
    83     my $parser = PS::IPP::Metadata::Config->new;        # Parser for metadata config files
     80    my $parser = PS::IPP::Metadata::Config->new;        # Parser for metadata config files
    8481    my $statsList = $parser->parse(join "", @contents) or &my_die("Unable to parse metadata for imfile stats", $PS_EXIT_SYS_ERROR);
    8582
     
    110107    open (DATA, ">$component.dat");
    111108    for (my $i = 0; $i < @{$nameX}; $i++) {
    112         print DATA "${$nameX}[$i] ${$nameY}[$i]\n";
     109        print DATA "${$nameX}[$i] ${$nameY}[$i]\n";
    113110    }
    114111    close (DATA);
     
    147144    my ($exp_time, $tag, $md) = @_;
    148145
    149     # descend through the fpa       
     146    # descend through the fpa
    150147    foreach my $entry (@$md) {
    151         # print STDERR "name: $entry->{name}, class: $entry->{class}\n";
     148        # print STDERR "name: $entry->{name}, class: $entry->{class}\n";
    152149        # recurse on nested metadata
    153150        if ($entry->{class} eq 'metadata') {
    154             my $newtag = $tag . "_" . $entry->{name};
     151            my $newtag = $tag . "_" . $entry->{name};
    155152            &parse_stats_table ($exp_time, $newtag, $entry->{value});
    156153        }
     
    161158                push @bg_stdev_data, $entry->{value};
    162159            } else {
    163                 push @bg_name,    $tag;
     160                push @bg_name,    $tag;
    164161                push @bg_data,    $entry->{value};
    165                 push @bg_exptime, $exp_time;
    166                 # print STDERR "$tag $exp_time $entry->{value}\n";
     162                push @bg_exptime, $exp_time;
     163                # print STDERR "$tag $exp_time $entry->{value}\n";
    167164            }
    168             if (!$componentsHash{$tag}) {
    169                 push @components, $tag;
    170                 $componentsHash{$tag} = 1;
    171             }
    172             next;
    173         }
     165            if (!$componentsHash{$tag}) {
     166                push @components, $tag;
     167                $componentsHash{$tag} = 1;
     168            }
     169            next;
     170        }
    174171    }
    175172    return 1;
  • trunk/ippScripts/scripts/magic_definerun.pl

    r21006 r23186  
    2525use PS::IPP::Config 1.01 qw( :standard );
    2626
    27 my $ipprc = PS::IPP::Config->new(); # IPP configuration
    28 
    2927use Getopt::Long qw( GetOptions :config auto_help auto_version gnu_getopt );
    3028use Pod::Usage qw( pod2usage );
    3129
     30# Look for programs we need
     31my $missing_tools;
     32my $magictool = can_run('magictool') or (warn "Can't find magictool" and $missing_tools = 1);
     33my $difftool  = can_run('difftool') or (warn "Can't find difftool" and $missing_tools = 1);
     34my $warptool  = can_run('warptool') or (warn "Can't find warptool" and $missing_tools = 1);
     35if ($missing_tools) {
     36    warn("Can't find required tools.");
     37    exit($PS_EXIT_CONFIG_ERROR);
     38}
     39
    3240# Parse the command-line arguments
    3341my ($exp_id, $warp_id, $min_diff_id, $label, $workdir, $dbname, $save_temps, $verbose);
    34 
    3542GetOptions(
    3643           'exp_id=s'        => \$exp_id,     # exposure identifier
     
    5057    defined $warp_id;
    5158
    52 # $ipprc->define_camera($camera);
    53 
    54 # Look for programs we need
    55 my $missing_tools;
    56 my $magictool = can_run('magictool') or (warn "Can't find magictool" and $missing_tools = 1);
    57 my $difftool  = can_run('difftool') or (warn "Can't find difftool" and $missing_tools = 1);
    58 my $warptool  = can_run('warptool') or (warn "Can't find warptool" and $missing_tools = 1);
    59 if ($missing_tools) {
    60     warn("Can't find required tools.");
    61     exit($PS_EXIT_CONFIG_ERROR);
    62 }
     59my $ipprc = PS::IPP::Config->new() or my_die("Unable to set up", $PS_EXIT_CONFIG_ERROR); # IPP configuration
    6360
    6461my $mdcParser = PS::IPP::Metadata::Config->new; # Parser for metadata config files
  • trunk/ippScripts/scripts/magic_destreak.pl

    r22430 r23186  
    2121
    2222use PS::IPP::Config 1.01 qw( :standard );
    23 
    24 my $ipprc = PS::IPP::Config->new(); # IPP configuration
    2523
    2624use Getopt::Long qw( GetOptions :config auto_help auto_version gnu_getopt );
     
    7674    defined $outroot;
    7775
    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 
     76my $ipprc = PS::IPP::Config->new( $camera ) or my_die( "Unable to set up", $magic_ds_id, $component, $PS_EXIT_CONFIG_ERROR ); # IPP configuration
     77$ipprc->redirect_output($logfile) or my_die( "Unable to redirect output", $magic_ds_id, $component, $PS_EXIT_SYS_ERROR ) if $logfile;
    8278
    8379my ($skycell_args, $class_id, $skycell_id);
     
    9490    &my_die("Invalid value for stage: $stage", $magic_ds_id, $component, $PS_EXIT_CONFIG_ERROR);
    9591}
    96 
    97 $ipprc->redirect_output($logfile) if $logfile;
    98 
    99 $ipprc->define_camera($camera);
    100 
    10192
    10293my $mdcParser = PS::IPP::Metadata::Config->new; # Parser for metadata config files
  • trunk/ippScripts/scripts/magic_mask.pl

    r22430 r23186  
    2222
    2323use PS::IPP::Config 1.01 qw( :standard );
    24 
    25 my $ipprc = PS::IPP::Config->new(); # IPP configuration
    2624
    2725use Getopt::Long qw( GetOptions :config auto_help auto_version gnu_getopt );
     
    5856    defined $outroot;
    5957
    60 # Unhandled exceptions should be passed on to my_die so they get pushed into the database
    61 $SIG{__DIE__} = sub { die @_ if $^S;
    62                       my_die( $_[0], $magic_id, $PS_EXIT_UNKNOWN_ERROR ); };
    63 
    64 $ipprc->define_camera($camera);
    65 
    66 $ipprc->redirect_output($logfile) if $logfile;
     58my $ipprc = PS::IPP::Config->new( $camera ) or my_die( "Unable to set up", $magic_id, $PS_EXIT_CONFIG_ERROR ); # IPP configuration
     59$ipprc->redirect_output($logfile) or my_die( "Unable to redirect output", $magic_id, $PS_EXIT_SYS_ERROR ) if $logfile;
    6760
    6861my $mdcParser = PS::IPP::Metadata::Config->new; # Parser for metadata config files
  • trunk/ippScripts/scripts/magic_process.pl

    r22430 r23186  
    2323
    2424use PS::IPP::Config 1.01 qw( :standard );
    25 
    26 my $ipprc = PS::IPP::Config->new(); # IPP configuration
    2725
    2826use Getopt::Long qw( GetOptions :config auto_help auto_version gnu_getopt );
     
    6260    defined $outroot;
    6361
    64 # Unhandled exceptions should be passed on to my_die so they get pushed into the database
    65 $SIG{__DIE__} = sub { die @_ if $^S;
    66                       my_die( $_[0], $magic_id, $node, $PS_EXIT_UNKNOWN_ERROR ); };
    67 
    68 $ipprc->define_camera($camera);
     62my $ipprc = PS::IPP::Config->new( $camera ) or my_die( "Unable to set up", $magic_id, $node, $PS_EXIT_CONFIG_ERROR ); # IPP configuration
     63$ipprc->redirect_output($logfile) or my_die( "Unable to redirect output", $magic_id, $node, $PS_EXIT_SYS_ERROR ) if $logfile;
    6964
    7065# RemoveStreaks doesn't know about nebulous. It expects to be able to append strings to outroot
     
    7368# of the file names as arguments
    7469if ($outroot =~ 'neb:/') {
    75     &my_die("RemoveStreaks does not support nebulous paths in outroot", $magic_id, $node,
    76         $PS_EXIT_CONFIG_ERROR);
     70    &my_die("RemoveStreaks does not support nebulous paths in outroot", $magic_id, $node, $PS_EXIT_CONFIG_ERROR);
    7771}
    7872
    7973# resolve any path:// or file:// in outroot
    8074$outroot = $ipprc->file_resolve($outroot);
    81 
    82 $ipprc->redirect_output($logfile) if $logfile;
    8375
    8476my $mdcParser = PS::IPP::Metadata::Config->new; # Parser for metadata config files
  • trunk/ippScripts/scripts/magic_tree.pl

    r22430 r23186  
    2424use File::Temp qw( tempfile );
    2525use PS::IPP::Config 1.01 qw( :standard );
    26 
    27 my $ipprc = PS::IPP::Config->new(); # IPP configuration
    2826
    2927use Getopt::Long qw( GetOptions :config auto_help auto_version gnu_getopt );
     
    7068    defined $outroot;
    7169
    72 # Unhandled exceptions should be passed on to my_die so they get pushed into the database
    73 $SIG{__DIE__} = sub { die @_ if $^S;
    74                       my_die( $_[0], $magic_id, $PS_EXIT_UNKNOWN_ERROR ); };
    75 
    76 $ipprc->define_camera($camera);
    77 
    78 $ipprc->redirect_output($logfile) if $logfile;
     70my $ipprc = PS::IPP::Config->new( $camera ) or my_die( "Unable to set up", $magic_id, $PS_EXIT_CONFIG_ERROR ); # IPP configuration
     71$ipprc->redirect_output($logfile) or my_die( "Unable to redirect output", $magic_id, $PS_EXIT_SYS_ERROR ) if $logfile;
    7972
    8073my $mdcParser = PS::IPP::Metadata::Config->new; # Parser for metadata config files
  • trunk/ippScripts/scripts/register_exp.pl

    r22430 r23186  
    2424use Getopt::Long qw( GetOptions :config auto_help auto_version gnu_getopt );
    2525use Pod::Usage qw( pod2usage );
    26 
    27 my $ipprc = PS::IPP::Config->new();
    2826
    2927# Look for commands we need
     
    5351) or pod2usage( 2 );
    5452
    55 # Unhandled exceptions should be passed on to my_die so they get pushed into the database
    56 $SIG{__DIE__} = sub { die @_ if $^S;
    57                       my_die( $_[0], $exp_id, $PS_EXIT_UNKNOWN_ERROR ); };
    58 
    59 $ipprc->redirect_output($logfile) if $logfile;
     53my $ipprc = PS::IPP::Config->new() or my_die( "Unable to set up", $exp_id, $PS_EXIT_CONFIG_ERROR );
     54$ipprc->redirect_output($logfile) or my_die( "Unable to redirect output", $exp_id, $PS_EXIT_SYS_ERROR ) if $logfile;
    6055
    6156pod2usage( -msg => "Unknown option: @ARGV", -exitval => 2 ) if @ARGV;
  • trunk/ippScripts/scripts/register_imfile.pl

    r22428 r23186  
    2323use Math::Trig;
    2424
    25 my $ipprc = PS::IPP::Config->new(); # IPP configuration
    2625use File::Spec;
    2726
     
    4948) or pod2usage( 2 );
    5049
    51 # Unhandled exceptions should be passed on to my_die so they get pushed into the database
    52 $SIG{__DIE__} = sub { die @_ if $^S;
    53                       my_die( $_[0], $exp_id, $tmp_exp_name, $tmp_class_id, $uri, $PS_EXIT_UNKNOWN_ERROR ); };
    54 
    55 $ipprc->redirect_output($logfile) if $logfile;
     50my $ipprc = PS::IPP::Config->new() or my_die( "Unable to set up", $exp_id, $tmp_exp_name, $tmp_class_id, $uri, $PS_EXIT_CONFIG_ERROR ); # IPP configuration
     51$ipprc->redirect_output($logfile) or my_die( "Unable to redirect output", $exp_id, $tmp_exp_name, $tmp_class_id, $uri, $PS_EXIT_SYS_ERROR ) if $logfile;
    5652
    5753pod2usage( -msg => "Unknown option: @ARGV", -exitval => 2 ) if @ARGV;
  • trunk/ippScripts/scripts/stack_skycell.pl

    r22430 r23186  
    2424use File::Basename;
    2525use PS::IPP::Config 1.01 qw( :standard );
    26 
    27 my $ipprc = PS::IPP::Config->new(); # IPP configuration
    2826
    2927use Getopt::Long qw( GetOptions :config auto_help auto_version gnu_getopt );
     
    6664    and defined $run_state;
    6765
    68 # Unhandled exceptions should be passed on to my_die so they get pushed into the database
    69 $SIG{__DIE__} = sub { die @_ if $^S;
    70                       my_die( $_[0], $stack_id, $PS_EXIT_UNKNOWN_ERROR ); };
     66my $ipprc = PS::IPP::Config->new() or my_die( "Unable to set up", $stack_id, $PS_EXIT_CONFIG_ERROR ); # IPP configuration
    7167
    7268# XXX camera is not known here; cannot use filerules...
     
    8177}
    8278
    83 $ipprc->redirect_output($logDest) if $redirect;
     79$ipprc->redirect_output($logDest) or my_die( "Unable to redirect output", $stack_id, $PS_EXIT_SYS_ERROR ) if $redirect;
    8480
    8581my $temp_images_exist = 0;
  • trunk/ippScripts/scripts/warp_overlap.pl

    r22430 r23186  
    2323use Getopt::Long qw( GetOptions :config auto_help auto_version gnu_getopt );
    2424use Pod::Usage qw( pod2usage );
    25 
    26 my $ipprc = PS::IPP::Config->new(); # IPP configuration
    2725
    2826# Look for programs we need
     
    4947) or pod2usage( 2 );
    5048
    51 $ipprc->redirect_output($logfile) if $logfile;
    52 
    5349pod2usage( -msg => "Unknown option: @ARGV", -exitval => 2 ) if @ARGV;
    5450pod2usage(
     
    5955    and defined $tess_dir;
    6056
    61 # Unhandled exceptions should be passed on to my_die so they get pushed into the database
    62 $SIG{__DIE__} = sub { die @_ if $^S;
    63                       my_die( $_[0], $warp_id, $PS_EXIT_UNKNOWN_ERROR ); };
    64 
    65 $ipprc->define_camera($camera);
     57my $ipprc = PS::IPP::Config->new( $camera ) or my_die( "Unable to set up", $warp_id, $PS_EXIT_CONFIG_ERROR ); # IPP configuration
     58$ipprc->redirect_output($logfile) or my_die( "Unable to redirect output", $warp_id, $PS_EXIT_SYS_ERROR ) if $logfile;
    6659
    6760&my_die("Tessellation identifier not provided: $tess_dir", $warp_id, $PS_EXIT_SYS_ERROR) unless $tess_dir ne "NULL";
  • trunk/ippScripts/scripts/warp_skycell.pl

    r22430 r23186  
    2424use PS::IPP::Metadata::List qw( parse_md_list );
    2525use PS::IPP::Config 1.01 qw( :standard );
    26 
    27 my $ipprc = PS::IPP::Config->new(); # IPP configuration
    2826
    2927# Look for programs we need
     
    6866    and defined $run_state;
    6967
    70 # Unhandled exceptions should be passed on to my_die so they get pushed into the database
    71 $SIG{__DIE__} = sub { die @_ if $^S;
    72                       my_die( $_[0], $warp_id, $skycell_id, $tess_dir, $PS_EXIT_UNKNOWN_ERROR ); };
    73 
    74 $ipprc->define_camera($camera);
    75 
    76 my $logDest = $ipprc->filename("LOG.EXP", $outroot, $skycell_id);
     68my $ipprc = PS::IPP::Config->new( $camera ) or my_die( "Unable to set up", $warp_id, $skycell_id, $tess_dir, $PS_EXIT_CONFIG_ERROR ); # IPP configuration
     69
     70my $logDest = $ipprc->filename("LOG.EXP", $outroot, $skycell_id) or my_die( "Unable to get log filename", $warp_id, $skycell_id, $tess_dir, $PS_EXIT_SYS_ERROR );
    7771$logDest .= ".update" if ($run_state eq 'update');
    7872
    79 $ipprc->redirect_output($logDest) if $redirect;
     73$ipprc->redirect_output($logDest) or my_die( "Unable to redirect output", $warp_id, $skycell_id, $tess_dir, $PS_EXIT_SYS_ERROR ) if $redirect;
    8074
    8175my $source_id = $ipprc->source_id($dbname, $PS_TABLE_ID_WARP);
Note: See TracChangeset for help on using the changeset viewer.