IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jun 10, 2008, 8:46:59 AM (18 years ago)
Author:
bills
Message:

Resolve log file and redirect output in scripts not in tasks

Location:
trunk/ippScripts/scripts
Files:
7 edited

Legend:

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

    r17671 r18048  
    2525
    2626my ( $det_id, $exp_id, $class_id, $det_type, $exp_tag, $input_uri, $camera, $dbname, $workdir, $reduction,
    27      $verbose, $no_update, $no_op );
     27     $verbose, $no_update, $no_op, $outroot, $redirect, $corr_id, $corr_type, $corr_uri );
    2828GetOptions(
    2929    'det_id|d=s'        => \$det_id,
     
    4141    'no-update'         => \$no_update,
    4242    'no-op'             => \$no_op,
     43    'outroot'           => \$outroot,
     44    'redirect-output'   => \$redirect,
    4345) or pod2usage( 2 );
    4446
     
    5658# XXX this exits with status = 0 on failure
    5759$ipprc->define_camera($camera);
     60
     61if ($redirect) {
     62    die "must suplly --outroot with --redirect-output" if !defined ($outroot);
     63    my $logDest     = $ipprc->filename("LOG.IMFILE", $outroot, $class_id)
     64       or &my_die("Missing entry from camera config", $det_id, $exp_id, $class_id, $PS_EXIT_CONFIG_ERROR);
     65    $ipprc->redirect_output($logDest);
     66}
    5867
    5968# Recipes to use as a function of detrend type
  • trunk/ippScripts/scripts/detrend_norm_apply.pl

    r17943 r18048  
    2626# Parse the command-line
    2727my ( $det_id, $iter, $class_id, $value, $input_uri, $camera, $det_type, $outroot, $dbname, $verbose,
    28      $no_update, $no_op );
     28     $no_update, $no_op, $redirect );
    2929GetOptions(
    3030    'det_id|d=s'        => \$det_id,     # Detrend ID
     
    4040    'no-update'         => \$no_update,  # Don't update the database
    4141    'no-op'             => \$no_op,      # Don't do any operations
     42    'redirect-output'   => \$redirect,   # send output from script to LOG.IMFILE
    4243    ) or pod2usage( 2 );
    4344
     
    5657$ipprc->define_camera($camera);
    5758
     59my $logDest = $ipprc->filename("LOG.IMFILE", $outroot, $class_id)
     60        or &my_die("Missing entry from camera config", $det_id, $iter, $class_id, $PS_EXIT_CONFIG_ERROR);
     61$ipprc->redirect_output($logDest) if $redirect;
     62
    5863my $RECIPE_PPIMAGE = 'PPIMAGE_N'; # Recipe to use with ppImage
    5964my $RECIPE_PPSTATS = 'CHIPSTATS'; # Recipe to use with ppStats
     
    100105my $statsName = $ipprc->filename("PPIMAGE.STATS", $outroot, $class_id) or &my_die("Missing entry from camera config", $det_id, $iter, $class_id, $PS_EXIT_CONFIG_ERROR);
    101106my $traceDest = $ipprc->filename("TRACE.IMFILE",  $outroot, $class_id) or &my_die("Missing entry from camera config", $det_id, $iter, $class_id, $PS_EXIT_CONFIG_ERROR);
    102 my $logDest   = $ipprc->filename("LOG.IMFILE",    $outroot, $class_id) or &my_die("Missing entry from camera config", $det_id, $iter, $class_id, $PS_EXIT_CONFIG_ERROR);
    103107
    104108# Run normalisation
  • trunk/ippScripts/scripts/detrend_process_exp.pl

    r17943 r18048  
    2727
    2828my ( $det_id, $exp_id, $det_type, $exp_tag, $camera, $outroot, $dbname, $reduction, $verbose, $no_update,
    29      $no_op, $save_temps );
     29     $no_op, $save_temps, $redirect );
    3030GetOptions(
    3131    'det_id|d=s'        => \$det_id,
     
    4141    'no-op'             => \$no_op,
    4242    'save-temps'        => \$save_temps, # Save temporary files?
     43    'redirect-output'   => \$redirect,
    4344) or pod2usage( 2 );
    4445
     
    5455
    5556$ipprc->define_camera($camera);
     57
     58if ($redirect) {
     59    my $logDest = $ipprc->filename("LOG.EXP", $outroot, "NONE")
     60        or &my_die("Missing entry in file rules", $det_id, $exp_id, $PS_EXIT_CONFIG_ERROR);
     61    $ipprc->redirect_output($logDest);
     62}
    5663
    5764# Recipes to use based on reduction class
  • trunk/ippScripts/scripts/detrend_process_imfile.pl

    r17971 r18048  
    2525
    2626my ( $det_id, $exp_id, $class_id, $det_type, $exp_tag, $input_uri, $camera, $outroot, $dbname, $reduction,
    27      $verbose, $no_update, $no_op );
     27     $verbose, $no_update, $no_op, $redirect );
    2828GetOptions(
    2929    'det_id|d=s'        => \$det_id,
     
    4040    'no-update'         => \$no_update,
    4141    'no-op'             => \$no_op,
     42    'redirect-output'   => \$redirect,
    4243) or pod2usage( 2 );
    4344
     
    5657# XXX this exits with status = 0 on failure
    5758$ipprc->define_camera($camera);
     59
     60my $logDest     = $ipprc->filename("LOG.IMFILE",     $outroot, $class_id)
     61      or &my_die("Missing entry from camera config", $exp_id, $exp_id, $class_id, $PS_EXIT_CONFIG_ERROR);
     62
     63$ipprc->redirect_output($logDest) if $redirect;
    5864
    5965# Recipes to use as a function of detrend type
     
    95101my $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);
    96102my $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);
    97 my $logDest     = $ipprc->filename("LOG.IMFILE",     $outroot, $class_id) or &my_die("Missing entry from camera config", $exp_id, $exp_id, $class_id, $PS_EXIT_CONFIG_ERROR);
    98 
    99103# Run ppImage
    100104unless ($no_op) {
  • trunk/ippScripts/scripts/detrend_reject_imfile.pl

    r17943 r18048  
    3636# parse the command-line options
    3737my ( $det_id, $iter, $exp_id, $exp_tag, $det_type, $camera, $filter, $reject, $outroot, $dbname, $reduction,
    38      $verbose, $no_update, $no_op, $save_temps );
     38     $verbose, $no_update, $no_op, $save_temps, $redirect );
    3939GetOptions(
    4040           'det_id|d=s'        => \$det_id,
     
    5353           'no-op'             => \$no_op,
    5454           'save-temps'        => \$save_temps, # Save temporary files?
     55           'redirect-output'   => \$redirect,   # redirect output from LOG.IMFILE
    5556           ) or pod2usage( 2 );
    5657
     
    6869# load IPP config information for the specified camera
    6970$ipprc->define_camera($camera);
     71if ($redirect) {
     72    # XXX should this really be going to LOG.IMFILE?
     73    # That's where detrend.resid.pro was sending it
     74    my $logDest     = $ipprc->filename("LOG.IMFILE", $outroot, "NONE")
     75       or &my_die("Missing entry from camera config", $det_id, $iter, $exp_id, $PS_EXIT_CONFIG_ERROR);
     76    $ipprc->redirect_output($logDest);
     77}
     78
    7079
    7180# Recipes to use based on reduction class
  • trunk/ippScripts/scripts/detrend_resid.pl

    r17971 r18048  
    2525
    2626my ( $det_id, $iter, $exp_id, $exp_tag, $class_id, $det_type, $detrend, $input_uri, $camera, $mode, $outroot,
    27      $dbname, $reduction, $verbose, $no_update, $no_op );
     27     $dbname, $reduction, $verbose, $no_update, $no_op, $redirect );
    2828GetOptions(
    2929    'det_id|d=s'        => \$det_id,
     
    4343    'no-update'         => \$no_update,
    4444    'no-op'             => \$no_op,
     45    'redirect-output'   => \$redirect,
    4546) or pod2usage( 2 );
    4647
     
    6162
    6263$ipprc->define_camera($camera);
     64my $logDest     = $ipprc->filename("LOG.IMFILE", $outroot, $class_id);
     65if ($redirect) {
     66    $ipprc->redirect_output($logDest);
     67}
    6368
    6469# Recipes to use as a function of detrend type and mode
     
    137142my $outputStats = $ipprc->filename("PPIMAGE.STATS",  $outroot, $class_id);
    138143my $traceDest   = $ipprc->filename("TRACE.IMFILE",   $outroot, $class_id);
    139 my $logDest     = $ipprc->filename("LOG.IMFILE",     $outroot, $class_id);
    140144
    141145# Run ppImage & ppStats
  • trunk/ippScripts/scripts/detrend_stack.pl

    r17941 r18048  
    1818use PS::IPP::Metadata::Stats;
    1919use PS::IPP::Metadata::List qw( parse_md_list );
    20 use File::Temp qw( tempfile );
    2120use PS::IPP::Config 1.01 qw( :standard );
    2221
     
    2726
    2827my ( $det_id, $iter, $class_id, $det_type, $camera, $outroot, $dbname, $reduction, $verbose, $save_temps,
    29      $no_update, $no_op );
     28     $no_update, $no_op, $redirect );
    3029GetOptions(
    3130    'det_id|d=s'        => \$det_id,
     
    3534    'camera|c=s'        => \$camera,
    3635    'outroot|w=s'       => \$outroot,   # output file base name
    37     'dbname|d=s'        => \$dbname, # Database name
     36    'dbname|d=s'        => \$dbname,    # Database name
    3837    'reduction=s'       => \$reduction, # Reduction class for processing
    3938    'verbose'           => \$verbose,   # Print to stdout
     
    4140    'no-update'         => \$no_update,
    4241    'no-op'             => \$no_op,
     42    'redirect-output'   => \$redirect,
    4343) or pod2usage( 2 );
     44
    4445
    4546pod2usage( -msg => "Unknown option: @ARGV", -exitval => 2 ) if @ARGV;
     
    5556$ipprc->define_camera($camera);
    5657$det_type = uc($det_type);
     58
     59my $logDest = $ipprc->filename("LOG.IMFILE", $outroot, $class_id)
     60    or &my_die("Missing entry in file rules", $det_id, $iter, $class_id, $PS_EXIT_CONFIG_ERROR);
     61
     62# optionally redirect the outputs from this script to LOG.IMFILE
     63$ipprc->redirect_output($logDest) if $redirect;
    5764
    5865# Recipes to use as a function of detrend type
     
    121128
    122129# Generate MDC file with the inputs
    123 my ($listFile, $listName) = tempfile( $ipprc->file_resolve("$outroot.$class_id.list.XXXX"), UNLINK => !$save_temps );
     130my ($listFile, $listName) = $ipprc->create_temp_file("$outroot.$class_id.list", $save_temps);
     131
    124132my $num = 0;
    125133foreach my $file (@$files) {
     
    161169my $outputStats = $ipprc->filename("PPIMAGE.STATS",  $outroot, $class_id) or &my_die("Missing entry in file rules", $det_id, $iter, $class_id, $PS_EXIT_CONFIG_ERROR); # Statistics name
    162170my $traceDest   = $ipprc->filename("TRACE.IMFILE",   $outroot, $class_id) or &my_die("Missing entry in file rules", $det_id, $iter, $class_id, $PS_EXIT_CONFIG_ERROR); # Trace messages
    163 my $logDest     = $ipprc->filename("LOG.IMFILE",     $outroot, $class_id) or &my_die("Missing entry in file rules", $det_id, $iter, $class_id, $PS_EXIT_CONFIG_ERROR); # Log messages
    164171
    165172$command = "$ppMerge $listName $outroot"; # Command to run
Note: See TracChangeset for help on using the changeset viewer.