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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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.