IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 27718


Ignore:
Timestamp:
Apr 21, 2010, 11:35:15 AM (16 years ago)
Author:
Paul Price
Message:

Add date of processing to output log.

Location:
trunk/ippScripts/scripts
Files:
45 edited

Legend:

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

    r26112 r27718  
    88use Sys::Hostname;
    99my $host = hostname();
     10my $date = `date`;
    1011print "\n\n";
    11 print "Starting script $0 on $host\n\n";
     12print "Starting script $0 on $host at $date\n\n";
    1213
    1314use DateTime;
  • trunk/ippScripts/scripts/calibrate_dvo.pl

    r23186 r27718  
    88use Sys::Hostname;
    99my $host = hostname();
     10my $date = `date`;
    1011print "\n\n";
    11 print "Starting script $0 on $host\n\n";
     12print "Starting script $0 on $host at $date\n\n";
    1213
    1314use vars qw( $VERSION );
  • trunk/ippScripts/scripts/camera_exp.pl

    r27555 r27718  
    88use Sys::Hostname;
    99my $host = hostname();
     10my $date = `date`;
    1011print "\n\n";
    11 print "Starting script $0 on $host\n\n";
     12print "Starting script $0 on $host at $date\n\n";
    1213
    1314use DateTime;
  • trunk/ippScripts/scripts/chip_imfile.pl

    r27180 r27718  
    88use Sys::Hostname;
    99my $host = hostname();
     10my $date = `date`;
    1011print "\n\n";
    11 print "Starting script $0 on $host\n\n";
     12print "Starting script $0 on $host at $date\n\n";
    1213
    1314use DateTime;
  • trunk/ippScripts/scripts/detrend_correct_imfile.pl

    r27180 r27718  
    88use Sys::Hostname;
    99my $host = hostname();
     10my $date = `date`;
    1011print "\n\n";
    11 print "Starting script $0 on $host\n\n";
    12 print "command: @ARGV\n\n";
     12print "Starting script $0 on $host at $date\n\n";
    1313
    1414use vars qw( $VERSION );
  • trunk/ippScripts/scripts/detrend_norm_apply.pl

    r27180 r27718  
    88use Sys::Hostname;
    99my $host = hostname();
     10my $date = `date`;
    1011print "\n\n";
    11 print "Starting script $0 on $host\n\n";
     12print "Starting script $0 on $host at $date\n\n";
    1213
    1314use vars qw( $VERSION );
  • trunk/ippScripts/scripts/detrend_norm_calc.pl

    r26514 r27718  
    88use Sys::Hostname;
    99my $host = hostname();
     10my $date = `date`;
    1011print "\n\n";
    11 print "Starting script $0 on $host\n\n";
     12print "Starting script $0 on $host at $date\n\n";
    1213
    1314use vars qw( $VERSION );
     
    5657
    5758# force det_type to be upper-case in this script
    58 my $det_type = uc($det_type);
     59$det_type = uc($det_type);
    5960
    6061my $ipprc = PS::IPP::Config->new() or my_die( "Unable to set up", $det_id, $iter, $PS_EXIT_CONFIG_ERROR ); # IPP configuration
  • trunk/ippScripts/scripts/detrend_norm_exp.pl

    r27180 r27718  
    88use Sys::Hostname;
    99my $host = hostname();
     10my $date = `date`;
    1011print "\n\n";
    11 print "Starting script $0 on $host\n\n";
     12print "Starting script $0 on $host at $date\n\n";
    1213
    1314use vars qw( $VERSION );
  • trunk/ippScripts/scripts/detrend_process_exp.pl

    r27180 r27718  
    88use Sys::Hostname;
    99my $host = hostname();
     10my $date = `date`;
    1011print "\n\n";
    11 print "Starting script $0 on $host\n\n";
     12print "Starting script $0 on $host at $date\n\n";
    1213
    1314use vars qw( $VERSION );
  • trunk/ippScripts/scripts/detrend_process_imfile.pl

    r27180 r27718  
    88use Sys::Hostname;
    99my $host = hostname();
     10my $date = `date`;
    1011print "\n\n";
    11 print "Starting script $0 on $host\n\n";
     12print "Starting script $0 on $host at $date\n\n";
    1213
    1314use vars qw( $VERSION );
  • trunk/ippScripts/scripts/detrend_reject_exp.pl

    r24764 r27718  
    88use Sys::Hostname;
    99my $host = hostname();
     10my $date = `date`;
    1011print "\n\n";
    11 print "Starting script $0 on $host\n\n";
     12print "Starting script $0 on $host at $date\n\n";
    1213
    1314use vars qw( $VERSION );
  • trunk/ippScripts/scripts/detrend_resid_imfile.pl

    r27180 r27718  
    88use Sys::Hostname;
    99my $host = hostname();
     10my $date = `date`;
    1011print "\n\n";
    11 print "Starting script $0 on $host\n\n";
     12print "Starting script $0 on $host at $date\n\n";
    1213
    1314use vars qw( $VERSION );
  • trunk/ippScripts/scripts/detrend_stack.pl

    r27180 r27718  
    88use Sys::Hostname;
    99my $host = hostname();
     10my $date = `date`;
    1011print "\n\n";
    11 print "Starting script $0 on $host\n\n";
     12print "Starting script $0 on $host at $date\n\n";
    1213
    1314use vars qw( $VERSION );
  • trunk/ippScripts/scripts/diff_skycell.pl

    r27596 r27718  
    77use Sys::Hostname;
    88my $host = hostname();
     9my $date = `date`;
    910print "\n\n";
    10 print "Starting script $0 on $host\n\n";
     11print "Starting script $0 on $host at $date\n\n";
    1112
    1213use DateTime;
  • trunk/ippScripts/scripts/dist_advancerun.pl

    r27016 r27718  
    88use Sys::Hostname;
    99my $host = hostname();
     10my $date = `date`;
    1011print "\n\n";
    11 print "Starting script $0 on $host\n\n";
     12print "Starting script $0 on $host at $date\n\n";
    1213
    1314use vars qw( $VERSION );
     
    174175        }
    175176        &my_die("unable to find path",  $dist_id, $PS_EXIT_UNKNOWN_ERROR) if !$path;
    176         my $component_dir = find_componentdir($destdir, $path); 
     177        my $component_dir = find_componentdir($destdir, $path);
    177178#        print MANIFEST "$component METADATA\n";
    178179        print MANIFEST "\t" , "$component", "\tSTR\t", $component_dir, "\n";
    179180    }
    180181    print MANIFEST "END\n\n";
    181     close MANIFEST or 
     182    close MANIFEST or
    182183        &my_die("Unable to close dirinfo file $dirinfo",  $dist_id, $PS_EXIT_UNKNOWN_ERROR);
    183184}
  • trunk/ippScripts/scripts/dist_bundle.pl

    r27449 r27718  
    88use Sys::Hostname;
    99my $host = hostname();
     10my $date = `date`;
    1011# print "\n\n";
    11 # print "Starting script $0 on $host\n\n";
     12# print "Starting script $0 on $host at $date\n\n";
    1213
    1314use vars qw( $VERSION );
     
    115116
    116117# Get the list of data products for this component
    117 # note: We my_die in get_file_list if something goes wrong. 
     118# note: We my_die in get_file_list if something goes wrong.
    118119
    119120my $file_list = get_file_list($stage, $component, $path_base, $clean);
     
    193194    $num_files++;
    194195    if ($image_type && $nan_masked_pixels) {
    195         # save the 
     196        # save the
    196197        if ($image_type eq 'image') {
    197198            $image = $file_name;
     
    222223    # One last check as to whether magic has been applied to the inputs
    223224
    224     # Note: the sql for disttool -pendingcomponent won't select a component that 
     225    # Note: the sql for disttool -pendingcomponent won't select a component that
    225226    # requires magic and hasn't been magicked, but we check again here
    226227
     
    327328### Pau.
    328329
    329 # return the image type (image, mask, or variance) if this file rule refers to 
     330# return the image type (image, mask, or variance) if this file rule refers to
    330331# one of the big fits files that are not included in a clean distribution
    331332sub get_image_type {
     
    360361sub open_with_retries {
    361362    my $name = shift;
    362    
     363
    363364    my $tries = 1;
    364365    my $max_tries = 5;
     
    372373        }
    373374    }
    374    
     375
    375376    &my_die("failed to open $name after $max_tries tries\n", $component,
    376377                    $PS_EXIT_DATA_ERROR) if (!$opened);
  • trunk/ippScripts/scripts/dist_cleanup.pl

    r26096 r27718  
    88use Sys::Hostname;
    99my $host = hostname();
     10my $date = `date`;
    1011print "\n\n";
    11 print "Starting script $0 on $host\n\n";
     12print "Starting script $0 on $host at $date\n\n";
    1213
    1314use vars qw( $VERSION );
  • trunk/ippScripts/scripts/dist_component.pl

    r27449 r27718  
    88use Sys::Hostname;
    99my $host = hostname();
     10my $date = `date`;
    1011print "\n\n";
    11 print "Starting script $0 on $host\n\n";
     12print "Starting script $0 on $host at $date\n\n";
    1213
    1314use vars qw( $VERSION );
  • trunk/ippScripts/scripts/dist_defineruns.pl

    r26998 r27718  
    1111use Sys::Hostname;
    1212my $host = hostname();
     13my $date = `date`;
    1314print "\n\n";
    14 print "Starting script $0 on $host\n\n";
     15print "Starting script $0 on $host at $date\n\n";
    1516
    1617use vars qw( $VERSION );
  • trunk/ippScripts/scripts/dist_make_fileset.pl

    r27014 r27718  
    88use Sys::Hostname;
    99my $host = hostname();
     10my $date = `date`;
    1011print "\n\n";
    11 print "Starting script $0 on $host\n\n";
     12print "Starting script $0 on $host at $date\n\n";
    1213
    1314use vars qw( $VERSION );
     
    4647           'dist_id=s'      => \$dist_id,    # distribution run identifier
    4748           'dist_dir=s'     => \$dist_dir,   # directory containing dist run outputs
    48            'target_id=s'    => \$target_id,  # 
     49           'target_id=s'    => \$target_id,  #
    4950           'stage=s'        => \$stage,      # raw, chip, camera, fake, warp, stack, or diff
    5051           'stage_id=s'     => \$stage_id,   # exp_id, chip_id, etc.
     
    209210    my $dsn = "DBI:mysql:host=$dbserver;database=$dbname";
    210211
    211     my $dbh = DBI->connect($dsn, $dbuser, $dbpassword) 
     212    my $dbh = DBI->connect($dsn, $dbuser, $dbpassword)
    212213        or die "Cannot connect to database.\n";
    213214
     
    227228
    228229    #
    229     # we are a long ways away from the rawExp in the pipeline. Rather than do some 
     230    # we are a long ways away from the rawExp in the pipeline. Rather than do some
    230231    # very long joins in disttool, we look up the exp_name in the database using DBI
    231232    #
    232233    my $dbh = getDBHandle($ipprc, $dbname);
    233234
    234     my $query; 
     235    my $query;
    235236
    236237    if ($stage eq 'raw') {
  • trunk/ippScripts/scripts/dqstats_bundle.pl

    r27308 r27718  
    88use Sys::Hostname;
    99my $host = hostname();
     10my $date = `date`;
    1011print "\n\n";
    11 print "Starting script $0 on $host\n\n";
     12print "Starting script $0 on $host at $date\n\n";
    1213
    1314use DateTime;
     
    3738my ( $dqstats_id, $camera, $uri, $dbname, $verbose, $no_update, $no_op, $redirect, $save_temps);
    3839GetOptions(
    39            'dqstats_id=s'    => \$dqstats_id, # dqstatsrun ID
    40            'camera|c=s'      => \$camera,  # camera
    41            'dbname|d=s'      => \$dbname,  # database name
    42            'uri=s'           => \$uri, # output file destination
    43            'verbose'         => \$verbose, # print to stdout
    44            'no-update'       => \$no_update, # Update the database
    45            'no-op'           => \$no_op,   # don't do the operations
    46            'redirect-output' => \$redirect,
    47            'save-temps'      => \$save_temps, # save temporary files
    48            ) or pod2usage( 2 );
     40           'dqstats_id=s'    => \$dqstats_id, # dqstatsrun ID
     41           'camera|c=s'      => \$camera,  # camera
     42           'dbname|d=s'      => \$dbname,  # database name
     43           'uri=s'           => \$uri, # output file destination
     44           'verbose'         => \$verbose, # print to stdout
     45           'no-update'       => \$no_update, # Update the database
     46           'no-op'           => \$no_op,   # don't do the operations
     47           'redirect-output' => \$redirect,
     48           'save-temps'      => \$save_temps, # save temporary files
     49           ) or pod2usage( 2 );
    4950
    5051pod2usage( -msg => "Unknown option: @ARGV", -exitval => 2 ) if @ARGV;
    5152pod2usage( -msg => "Required options --dqstats_id --camera",
    52            -exitval => 3,
    53            ) unless
     53           -exitval => 3,
     54           ) unless
    5455    defined $dqstats_id and
    5556    defined $camera;
    5657
    57 my $ipprc = PS::IPP::Config->new( $camera ) 
     58my $ipprc = PS::IPP::Config->new( $camera )
    5859    or my_die( "Unable to set up", $dqstats_id, $PS_EXIT_CONFIG_ERROR ); # IPP config
    59 #my $logDest = $ipprc->filename("LOG.EXP", $uri) 
     60#my $logDest = $ipprc->filename("LOG.EXP", $uri)
    6061#    or my_die("Missing entry from camera config", $dqstats_id, $PS_EXIT_CONFIG_ERROR);
    6162
    6263if ($redirect) {
    63 #    $ipprc->redirect_output($logDest) 
    64 #       or my_die( "Unable to redirect output", $dqstats_id, $PS_EXIT_SYS_ERROR );
     64#    $ipprc->redirect_output($logDest)
     65#       or my_die( "Unable to redirect output", $dqstats_id, $PS_EXIT_SYS_ERROR );
    6566    print "\n\n";
    6667    print "Starting script $0 on $host\n\n";
     
    8485unless ($no_op) {
    8586    # This bit needs to make the bundle.
    86    
     87
    8788    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    88         run(command => $bundle_command, verbose => $verbose);
     89        run(command => $bundle_command, verbose => $verbose);
    8990    unless ($success) {
    90         $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
    91         &my_die("Unable to create the bundle.: $error_code", $dqstats_id, $error_code);
     91        $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
     92        &my_die("Unable to create the bundle.: $error_code", $dqstats_id, $error_code);
    9293    }
    93    
     94
    9495    # Parse stdout_buf to get output file name
    9596    ## Begin partial
    9697    my ($tempFile, $tempName) = tempfile( "/tmp/dqstats.XXXX",
    97                                           UNLINK => !$save_temps, SUFFIX => 'dsin' );
     98                                          UNLINK => !$save_temps, SUFFIX => 'dsin' );
    9899    print $tempFile $uri . '|||notset' . "\n";
    99100
     
    102103    # It can't be that simple, can it? This should probably add a fault on failure.
    103104    ($success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    104         run(command => $register_cmd, verbose => $verbose);
     105        run(command => $register_cmd, verbose => $verbose);
    105106    unless ($success) {
    106         $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
    107         &my_die("Unable to register the bundle.: $error_code", $dqstats_id, $error_code);
     107        $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
     108        &my_die("Unable to register the bundle.: $error_code", $dqstats_id, $error_code);
    108109    }
    109    
     110
    110111    # We no longer need the file generated by dqstatstool.
    111112    unlink($uri);
     
    118119    # This bit needs to set the database state to full
    119120    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    120         run(command => $update_command, verbose => $verbose);
     121        run(command => $update_command, verbose => $verbose);
    121122    unless ($success) {
    122         $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
    123         warn("Unable to add result to database: $error_code\n");
    124         exit($error_code);
     123        $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
     124        warn("Unable to add result to database: $error_code\n");
     125        exit($error_code);
    125126    }
    126127} else {
     
    139140    carp($msg);
    140141    if (defined $dqstats_id and not $no_update) {
    141         # There is no fault handling, which may be a mistake. This is where a fault coding would be.
     142        # There is no fault handling, which may be a mistake. This is where a fault coding would be.
    142143#         my $command = "$addtool -add_id $add_id";
    143144#         $command .= " -addprocessedexp";
  • trunk/ippScripts/scripts/fake_imfile.pl

    r23688 r27718  
    2424use Sys::Hostname;
    2525my $host = hostname();
     26my $date = `date`;
    2627print "\n\n";
    27 print "Starting script $0 on $host\n\n";
     28print "Starting script $0 on $host at $date\n\n";
    2829
    2930use DateTime;
  • trunk/ippScripts/scripts/flatcorr_init.pl

    r20100 r27718  
    11#!/usr/bin/env perl
    22
    3 ## USAGE:flatcorr_init.pl 
     3## USAGE:flatcorr_init.pl
    44## given dbname, dvodb, filter, time range, camera, telescope, etc?
    55## select matching images and register as a new flatcorr run
     
    2424use Sys::Hostname;
    2525my $host = hostname();
     26my $date = `date`;
    2627print "\n\n";
    27 print "Starting script $0 on $host\n\n";
     28print "Starting script $0 on $host at $date\n\n";
    2829
    2930use vars qw( $VERSION );
     
    6869my $caltool  = can_run('caltool')  or (warn "Can't find caltool"  and $missing_tools = 1);
    6970
    70 if ($missing_tools) { 
     71if ($missing_tools) {
    7172    warn ("Can't find required tools");
    72     exit($PS_EXIT_CONFIG_ERROR); 
     73    exit($PS_EXIT_CONFIG_ERROR);
    7374}
    7475
     
    9091        cache_run(command => $command, verbose => 1);
    9192
    92     unless ($success) { 
     93    unless ($success) {
    9394        $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
    9495        &my_die ("Unable to perform addstar -resort on region $region: $error_code", $dvo_id, $region, "RESORT", $status, $dbname);
     
    99100{
    100101    foreach my $filter (@filters) {
    101         my $command = "$relphot $filter";
    102         $command .= "-D CATDIR $catdir";
    103         $command .= "-region $RAs $RAe $DECs $DECe";
    104 
    105         my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    106             cache_run(command => $command, verbose => 1);
    107 
    108         unless ($success) {
    109             $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
    110             &my_die ("Unable to perform addstar -resort on region $region: $error_code", $dvo_id, $region, "RELPHOT", $status, $dbname);
    111         }
     102        my $command = "$relphot $filter";
     103        $command .= "-D CATDIR $catdir";
     104        $command .= "-region $RAs $RAe $DECs $DECe";
     105
     106        my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
     107            cache_run(command => $command, verbose => 1);
     108
     109        unless ($success) {
     110            $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
     111            &my_die ("Unable to perform addstar -resort on region $region: $error_code", $dvo_id, $region, "RELPHOT", $status, $dbname);
     112        }
    112113    }
    113114}
     
    117118if (0) {
    118119    foreach my $filter (@filters) {
    119         my $command = "$uniphot $filter";
    120         $command .= "-D CATDIR $catdir";
    121         $command .= "-region $RAs $RAe $DECs $DECe";
    122 
    123         my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    124             cache_run(command => $command, verbose => 1);
    125 
    126         unless ($success) {
    127             $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
    128             &my_die ("Unable to perform addstar -resort on region $region: $error_code", $dvo_id, $region, "UNIPHOT", $status, $dbname);
    129         }
     120        my $command = "$uniphot $filter";
     121        $command .= "-D CATDIR $catdir";
     122        $command .= "-region $RAs $RAe $DECs $DECe";
     123
     124        my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
     125            cache_run(command => $command, verbose => 1);
     126
     127        unless ($success) {
     128            $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
     129            &my_die ("Unable to perform addstar -resort on region $region: $error_code", $dvo_id, $region, "UNIPHOT", $status, $dbname);
     130        }
    130131    }
    131132}
     
    137138
    138139    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    139         cache_run(command => $command, verbose => 1);
    140 
    141     unless ($success) { 
    142         $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
    143         &my_die ("Unable to perform addstar -resort on region $region: $error_code", $dvo_id, $region, "RELASTRO.OBJECTS", $status, $dbname);
     140        cache_run(command => $command, verbose => 1);
     141
     142    unless ($success) {
     143        $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
     144        &my_die ("Unable to perform addstar -resort on region $region: $error_code", $dvo_id, $region, "RELASTRO.OBJECTS", $status, $dbname);
    144145    }
    145146}
     
    151152
    152153    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    153         cache_run(command => $command, verbose => 1);
    154 
    155     unless ($success) { 
    156         $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
    157         &my_die ("Unable to perform addstar -resort on region $region: $error_code", $dvo_id, $region, "RELASTRO.IMAGES", $status, $dbname);
     154        cache_run(command => $command, verbose => 1);
     155
     156    unless ($success) {
     157        $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
     158        &my_die ("Unable to perform addstar -resort on region $region: $error_code", $dvo_id, $region, "RELASTRO.IMAGES", $status, $dbname);
    158159    }
    159160}
     
    185186    my $region    = shift;
    186187    my $last_step = shift;
    187     my $status    = shift;
    188     my $dbname    = shift;
     188    my $status    = shift;
     189    my $dbname    = shift;
    189190
    190191    carp($msg);
    191192    if (defined $dvo_id && defined $region && defined $last_step && defined $status and not $no_update) {
    192193        my $command = "$caltool -addcalrun";
    193         $command .= " -dvo_id $dvo_id";
     194        $command .= " -dvo_id $dvo_id";
    194195        $command .= " -region $region";
    195         $command .= " -last_step $last_step";
    196         $command .= " -status $status";
     196        $command .= " -last_step $last_step";
     197        $command .= " -status $status";
    197198        $command .= " -dbname $dbname" if defined $dbname;
    198199        system ($command);
  • trunk/ippScripts/scripts/flatcorr_proc.pl

    r25916 r27718  
    1111# dvoMakeCorr -file outgrid.fits -ref ref.fits outcorr
    1212
    13 # dettool -register -det_type FLATCORR -filelevel (level) -workdir -inst, etc 
    14 
    15 # foreach $imfile () 
     13# dettool -register -det_type FLATCORR -filelevel (level) -workdir -inst, etc
     14
     15# foreach $imfile ()
    1616#   dettool -register_imfile -uri, etc, etc
    1717
     
    2323use Sys::Hostname;
    2424my $host = hostname();
     25my $date = `date`;
    2526print "\n\n";
    26 print "Starting script $0 on $host\n\n";
     27print "Starting script $0 on $host at $date\n\n";
    2728
    2829use vars qw( $VERSION );
     
    7475my $addstar     = can_run('addstar')      or (warn "Can't find addstar"      and $missing_tools = 1);
    7576my $dvoMakeCorr = can_run('dvoMakeCorr')  or (warn "Can't find dvoMakeCorr"  and $missing_tools = 1);
    76 my $detselect   = can_run('detselect')    or (warn "Can't find detselect"    and $missing_tools = 1);
    77 my $dettool     = can_run('dettool')      or (warn "Can't find dettool"      and $missing_tools = 1);
    78 my $flatcorr    = can_run('flatcorr')     or (warn "Can't find flatcorr"     and $missing_tools = 1);
    79 
    80 if ($missing_tools) { 
     77my $detselect   = can_run('detselect')    or (warn "Can't find detselect"    and $missing_tools = 1);
     78my $dettool     = can_run('dettool')      or (warn "Can't find dettool"      and $missing_tools = 1);
     79my $flatcorr    = can_run('flatcorr')     or (warn "Can't find flatcorr"     and $missing_tools = 1);
     80
     81if ($missing_tools) {
    8182    warn ("Can't find required tools");
    82     exit($PS_EXIT_CONFIG_ERROR); 
     83    exit($PS_EXIT_CONFIG_ERROR);
    8384}
    8485
     
    9596$ipprc->outroot_prepare($outcorr);
    9697
    97 if (not -e "$dvodb/flatcorr") { 
     98if (not -e "$dvodb/flatcorr") {
    9899    mkdir "$dvodb/flatcorr" or &my_die ("Unable to make output directory for relphot $dvodb/flatcorr", $corr_id, 3);
    99100}
     
    104105my ($DECs, $DECe) = split (",", $coords[1]);
    105106
    106 # Run addstar -resort to ensure the db is indexed 
     107# Run addstar -resort to ensure the db is indexed
    107108# XXX addstar should be able to recognize and skip indexed tables
    108109{
    109     my $command = "$addstar -resort"; 
     110    my $command = "$addstar -resort";
    110111    $command .= " -D CATDIR $dvodb";
    111112    $command .= " -region $RAs $RAe $DECs $DECe";
    112113
    113114    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    114         run(command => $command, verbose => $verbose);
    115 
    116     unless ($success) { 
    117         $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
    118         &my_die ("Unable to perform addstar -resort for dvodb $dvodb on region $region: $error_code", $corr_id, $error_code);
     115        run(command => $command, verbose => $verbose);
     116
     117    unless ($success) {
     118        $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
     119        &my_die ("Unable to perform addstar -resort for dvodb $dvodb on region $region: $error_code", $corr_id, $error_code);
    119120    }
    120121}
     
    135136
    136137    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    137         run(command => $command, verbose => $verbose);
    138 
    139     unless ($success) { 
    140         $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
    141         &my_die ("Unable to perform relphot -grid for dvodb $dvodb on region $region: $error_code", $corr_id, $error_code);
     138        run(command => $command, verbose => $verbose);
     139
     140    unless ($success) {
     141        $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
     142        &my_die ("Unable to perform relphot -grid for dvodb $dvodb on region $region: $error_code", $corr_id, $error_code);
    142143    }
    143144}
     
    176177
    177178# Push the results into the database
    178 { 
     179{
    179180    my $command = "$flatcorr -addprocess";
    180181    $command .= " -corr_id $corr_id";
     
    184185    unless ($no_update) {
    185186
    186         my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    187             run(command => $command, verbose => $verbose);
    188         unless ($success) {
    189             $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
    190             warn ("Unable to perform regtool -addprocessedimfile: $error_code");
    191             exit($error_code);
    192         }
     187        my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
     188            run(command => $command, verbose => $verbose);
     189        unless ($success) {
     190            $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
     191            warn ("Unable to perform regtool -addprocessedimfile: $error_code");
     192            exit($error_code);
     193        }
    193194    } else {
    194         print "skipping command: $command\n";
     195        print "skipping command: $command\n";
    195196    }
    196197}
     
    218219        &my_die("Unable to parse metadata list", $corr_id, $PS_EXIT_PROG_ERROR);
    219220
    220     # check for existence 
     221    # check for existence
    221222    my $file = $$files[0];
    222223    my $chip_id = $file->{chip_id};
     
    228229# flatcorr -inputimfile -chip_id $chip_id
    229230sub get_imfiles {
    230     my $chip_id = shift; 
     231    my $chip_id = shift;
    231232
    232233    my $command = "$flatcorr -inputimfile";
     
    273274
    274275    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    275         run(command => $command, verbose => $verbose);
    276 
    277     unless ($success) { 
    278         $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
    279         &my_die ("Unable to register new detrend: $error_code", $corr_id, $PS_EXIT_PROG_ERROR);
     276        run(command => $command, verbose => $verbose);
     277
     278    unless ($success) {
     279        $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
     280        &my_die ("Unable to register new detrend: $error_code", $corr_id, $PS_EXIT_PROG_ERROR);
    280281    }
    281282
     
    298299
    299300    foreach my $file (@$files) {
    300         # create the detrend correction for the imfiles based on the input imfiles
    301         my $reffile = $file->{uri};
    302         my $class_id = $file->{class_id};
    303 
    304         my $uri = $ipprc->filename("DVOCORR.OUTPUT", $outcorr, $class_id);
    305         unless ($uri) {
    306             &my_die ("Unable to find DVOCORR.OUTPUT in filerules", $corr_id, $PS_EXIT_PROG_ERROR);
    307         }
    308 
    309         my $command = "$dvoMakeCorr $outcorr";
    310         $command .= " -file $outgrid.fits";
    311         $command .= " -ref $reffile";
    312 
    313         my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    314             run(command => $command, verbose => $verbose);
    315 
    316         unless ($success) {
    317             $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
    318             &my_die ("Unable to perform dvoMakeCorr: $error_code", $corr_id, $PS_EXIT_PROG_ERROR);
    319         }
    320 
    321         # register the detrend correction imfile
    322         $command = "$dettool -register_detrend_imfile";
    323         $command .= " -det_id $det_id";
    324         $command .= " -class_id $class_id";
    325         $command .= " -uri $uri";
    326         $command .= " -dbname $dbname" if defined $dbname;
    327 
    328         ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    329             run(command => $command, verbose => $verbose);
    330 
    331         unless ($success) {
    332             $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
    333             &my_die ("Unable to register new detrend: $error_code", $corr_id, $PS_EXIT_PROG_ERROR);
    334         }
     301        # create the detrend correction for the imfiles based on the input imfiles
     302        my $reffile = $file->{uri};
     303        my $class_id = $file->{class_id};
     304
     305        my $uri = $ipprc->filename("DVOCORR.OUTPUT", $outcorr, $class_id);
     306        unless ($uri) {
     307            &my_die ("Unable to find DVOCORR.OUTPUT in filerules", $corr_id, $PS_EXIT_PROG_ERROR);
     308        }
     309
     310        my $command = "$dvoMakeCorr $outcorr";
     311        $command .= " -file $outgrid.fits";
     312        $command .= " -ref $reffile";
     313
     314        my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
     315            run(command => $command, verbose => $verbose);
     316
     317        unless ($success) {
     318            $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
     319            &my_die ("Unable to perform dvoMakeCorr: $error_code", $corr_id, $PS_EXIT_PROG_ERROR);
     320        }
     321
     322        # register the detrend correction imfile
     323        $command = "$dettool -register_detrend_imfile";
     324        $command .= " -det_id $det_id";
     325        $command .= " -class_id $class_id";
     326        $command .= " -uri $uri";
     327        $command .= " -dbname $dbname" if defined $dbname;
     328
     329        ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
     330            run(command => $command, verbose => $verbose);
     331
     332        unless ($success) {
     333            $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
     334            &my_die ("Unable to register new detrend: $error_code", $corr_id, $PS_EXIT_PROG_ERROR);
     335        }
    335336    }
    336337}
     
    345346    if (not $no_update) {
    346347        my $command = "$flatcorr -addprocess";
    347         $command .= " -corr_id $corr_id";
     348        $command .= " -corr_id $corr_id";
    348349        $command .= " -fault $exit_code";
    349350        $command .= " -hostname $host" if defined $host;
  • trunk/ippScripts/scripts/ipp_detrend_combine.pl

    r17671 r27718  
    77use Sys::Hostname;
    88my $host = hostname();
     9my $date = `date`;
    910print "\n\n";
    10 print "Starting script $0 on $host\n\n";
     11print "Starting script $0 on $host at $date\n\n";
    1112
    1213use vars qw( $VERSION );
     
    3233    $workdir, $dbname, $no_update);
    3334GetOptions(
    34            'det_type=s'    => \$det_type, # Detrend type for new detrend
    35            'filelevel=s'   => \$filelevel, # File level for new detrend
    36            'inst=s'        => \$inst, # Instrument for new detrend
    37            'telescope=s'   => \$telescope, # Telescope for new detrend
    38            'filter=s'      => \$filter, # Filter name for new detrend
    39            'det_id1=s'     => \$det_id1, # Detrend id for detrend 1
    40            'iteration1=s'  => \$iter1, # Iteration for detrend 1
    41            'det_id2=s'     => \$det_id2, # Detrend id for detrend 2
    42            'iteration2=s'  => \$iter2, # Iteration for detrend 2
    43            'operation=s'   => \$operation, # Operation to perform on files
    44            'mask'          => \$mask, # Operation is on a mask
    45            'workdir=s'     => \$workdir, # Working directory for output files
    46            'dbname=s'      => \$dbname, # Database name
    47            'no-update'     => \$no_update, # Don't update the database
    48            ) or pod2usage( 2 );
     35           'det_type=s'    => \$det_type, # Detrend type for new detrend
     36           'filelevel=s'   => \$filelevel, # File level for new detrend
     37           'inst=s'        => \$inst, # Instrument for new detrend
     38           'telescope=s'   => \$telescope, # Telescope for new detrend
     39           'filter=s'      => \$filter, # Filter name for new detrend
     40           'det_id1=s'     => \$det_id1, # Detrend id for detrend 1
     41           'iteration1=s'  => \$iter1, # Iteration for detrend 1
     42           'det_id2=s'     => \$det_id2, # Detrend id for detrend 2
     43           'iteration2=s'  => \$iter2, # Iteration for detrend 2
     44           'operation=s'   => \$operation, # Operation to perform on files
     45           'mask'          => \$mask, # Operation is on a mask
     46           'workdir=s'     => \$workdir, # Working directory for output files
     47           'dbname=s'      => \$dbname, # Database name
     48           'no-update'     => \$no_update, # Don't update the database
     49           ) or pod2usage( 2 );
    4950
    5051pod2usage( -msg => "Unknown option: @ARGV", -exitval => 2 ) if @ARGV;
    5152pod2usage( -msg => "Required options --det_type --filelevel --inst --telescope --det_id1 --iteration1 --det_id2 --iteration2 --workdir",
    52            -exitval => 3,
    53            )
     53           -exitval => 3,
     54           )
    5455    unless defined $det_type
    5556    and defined $filelevel
     
    6566$ipprc->define_camera($inst);
    6667
    67 my $STATS = 
    68    [   
     68my $STATS =
     69   [
    6970       #          PPSTATS KEYWORD         STATISTIC          CHIPTOOL FLAG
    7071       { name => "ROBUST_MEDIAN",  type => "mean",  flag => "-bg",             dtype => "float" },
     
    9091die("File lists for detrends have differing lengths") unless scalar keys %$files1 == scalar keys %$files2;
    9192
    92 my ($det_id, $iter);          # Detrend identifier for the new detrend
     93my ($det_id, $iter);          # Detrend identifier for the new detrend
    9394unless ($no_update) {
    9495    my $command = "$dettool -register_detrend -det_type $det_type -filelevel $filelevel -workdir $workdir " .
    95         "-inst $inst -telescope $telescope"; # Command to run
     96        "-inst $inst -telescope $telescope"; # Command to run
    9697    $command .= " -filter $filter" if defined $filter;
    9798    $command .= " -dbname $dbname" if defined $dbname;
    9899    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    99         run(command => $command, verbose => 1);
     100        run(command => $command, verbose => 1);
    100101    unless ($success) {
    101         $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
    102         die("Unable to run dettool -register_detrend: $error_code");
     102        $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
     103        die("Unable to run dettool -register_detrend: $error_code");
    103104    }
    104105
     
    137138    $command .= " -dbname $dbname" if defined $dbname;
    138139    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    139         run(command => $command, verbose => 1);
     140        run(command => $command, verbose => 1);
    140141    unless ($success) {
    141         $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
    142         die("Unable to run ppArith: $error_code");
     142        $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
     143        die("Unable to run ppArith: $error_code");
    143144    }
    144145
     
    149150    my $stats = PS::IPP::Metadata::Stats->new($STATS); # Stats parser
    150151    {
    151         my $statsFile;          # File handle
    152         open $statsFile, $ipprc->file_resolve($outStats) or die("Can't open stats file $outStats: $!");
    153         my @contents = <$statsFile>; # Contents of file
    154         close $statsFile;
    155        
    156         my $metadata = $mdcParser->parse(join "", @contents) or die("Unable to parse metadata config doc");
    157 
    158         unless ($stats->parse($metadata)) {
    159             &my_die("Failure extracting metadata from the statistics output file.\n");
    160         }
     152        my $statsFile;          # File handle
     153        open $statsFile, $ipprc->file_resolve($outStats) or die("Can't open stats file $outStats: $!");
     154        my @contents = <$statsFile>; # Contents of file
     155        close $statsFile;
     156
     157        my $metadata = $mdcParser->parse(join "", @contents) or die("Unable to parse metadata config doc");
     158
     159        unless ($stats->parse($metadata)) {
     160            &my_die("Failure extracting metadata from the statistics output file.\n");
     161        }
    161162    }
    162163
    163164    # Register the imfile
    164165    unless ($no_update) {
    165         my $command = "$dettool -register_detrend_imfile -det_id $det_id "; # Command to run
    166         $command .= " -class_id $class_id -uri $outName -path_base $outRoot";
    167         $command .= $stats->cmdflags();
    168         $command .= " -dbname $dbname" if defined $dbname;
    169         my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    170             run(command => $command, verbose => 1);
    171         unless ($success) {
    172             $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
    173             die("Unable to run dettool -register_detrend_imfile: $error_code");
    174         }
     166        my $command = "$dettool -register_detrend_imfile -det_id $det_id "; # Command to run
     167        $command .= " -class_id $class_id -uri $outName -path_base $outRoot";
     168        $command .= $stats->cmdflags();
     169        $command .= " -dbname $dbname" if defined $dbname;
     170        my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
     171            run(command => $command, verbose => 1);
     172        unless ($success) {
     173            $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
     174            die("Unable to run dettool -register_detrend_imfile: $error_code");
     175        }
    175176    }
    176177}
     
    183184sub filelist
    184185{
    185     my $det_id = shift;         # Detrend identifier
    186     my $iter = shift;           # Iteration
     186    my $det_id = shift;         # Detrend identifier
     187    my $iter = shift;           # Iteration
    187188
    188189    my $command = "$detselect -select -det_id $det_id -iteration $iter"; # Command to run
    189190    $command .= " -dbname $dbname" if defined $dbname;
    190191    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    191         run(command => $command, verbose => 1);
     192        run(command => $command, verbose => 1);
    192193    unless ($success) {
    193         $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
    194         die("Unable to run detselect: $error_code");
     194        $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
     195        die("Unable to run detselect: $error_code");
    195196    }
    196197
     
    202203
    203204    foreach my $item ( @$list ) {
    204         my $class_id = $item->{class_id};
    205         die("Multiple definitions of class_id=$class_id found for det_id=$det_id, iteration=$iter\n") if
    206             defined $files{$class_id};
    207         $files{$class_id} = parse_md_list($md);
     205        my $class_id = $item->{class_id};
     206        die("Multiple definitions of class_id=$class_id found for det_id=$det_id, iteration=$iter\n") if
     207            defined $files{$class_id};
     208        $files{$class_id} = parse_md_list($md);
    208209    }
    209210
  • trunk/ippScripts/scripts/lossy_compress_imfile.pl

    r27193 r27718  
    88use Sys::Hostname;
    99my $host = hostname();
     10my $date = `date`;
    1011print "\n\n";
    11 print "Starting script $0 on $host\n\n";
     12print "Starting script $0 on $host at $date\n\n";
    1213
    1314use vars qw( $VERSION );
     
    8687if ($state eq 'goto_compressed') {
    8788    # Find the actual filename for this run:
    88     &my_die("Couldn't find input file: $uri\n", $exp_id,$exp_name,$class_id,$uri,$PS_EXIT_SYS_ERROR) 
    89         unless ($ipprc->file_exists($uri));
     89    &my_die("Couldn't find input file: $uri\n", $exp_id,$exp_name,$class_id,$uri,$PS_EXIT_SYS_ERROR)
     90        unless ($ipprc->file_exists($uri));
    9091    my $uriReal = $ipprc->file_resolve( $uri );
    9192
    9293    # Create a compressed version:
    9394    my $compUri = $uri . ".fz";
    94     &my_die("Output compressed file already exists: $compUri\n", $exp_id,$exp_name,$class_id,$uri,$PS_EXIT_SYS_ERROR) 
    95         if ($ipprc->file_exists($compUri));
     95    &my_die("Output compressed file already exists: $compUri\n", $exp_id,$exp_name,$class_id,$uri,$PS_EXIT_SYS_ERROR)
     96        if ($ipprc->file_exists($compUri));
    9697    my $compReal= $ipprc->file_resolve( $compUri, 'create');
    9798    # Apparently we need to funpack before fpacking.  Probably should have realized that beforehand.
    9899    my $tempfile = new File::Temp ( TEMPLATE => "${exp_name}.XXXX",
    99                                     DIR => '/tmp/',
    100                                     UNLINK => !$save_temps,
    101                                     SUFFIX => '.fits');
     100                                    DIR => '/tmp/',
     101                                    UNLINK => !$save_temps,
     102                                    SUFFIX => '.fits');
    102103    my $tempReal = $tempfile->filename;
    103104
    104105    my $uncompress_command = "$funpack -S $uriReal > $tempReal";
    105106    my ($success, $error_code, $full_buf, $stdout_buf, $stderr_buf) =
    106         run(command => $uncompress_command, verbose => $verbose);
     107        run(command => $uncompress_command, verbose => $verbose);
    107108    unless ($success) {
    108         $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
    109         &my_die("Unable to uncompress file: $uri -> $compUri: $error_code",
    110                 $exp_id,$exp_name,$class_id,$uri, $PS_EXIT_SYS_ERROR);
     109        $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
     110        &my_die("Unable to uncompress file: $uri -> $compUri: $error_code",
     111                $exp_id,$exp_name,$class_id,$uri, $PS_EXIT_SYS_ERROR);
    111112    }
    112113    my $compress_command = "$fpack -h -s 8 -S $tempReal >  $compReal";
    113114    print STDERR "$compReal $uriReal $compress_command\n";
    114115    ($success, $error_code, $full_buf, $stdout_buf, $stderr_buf) =
    115         run(command => $compress_command, verbose => $verbose);
     116        run(command => $compress_command, verbose => $verbose);
    116117    unless ($success) {
    117         $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
    118         &my_die("Unable to compress file: $uri -> $compUri: $error_code",
    119                 $exp_id,$exp_name,$class_id,$uri, $PS_EXIT_SYS_ERROR);
     118        $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
     119        &my_die("Unable to compress file: $uri -> $compUri: $error_code",
     120                $exp_id,$exp_name,$class_id,$uri, $PS_EXIT_SYS_ERROR);
    120121    }
    121122    my $database_command = "$regtool -updateprocessedimfile -exp_id $exp_id -class_id $class_id -set_state compressed";
     
    123124
    124125    &my_die("Expected output compressed file not found: $compUri\n", $exp_id,$exp_name,$class_id, $uri,$PS_EXIT_SYS_ERROR)
    125         unless ($ipprc->file_exists($compUri));
     126        unless ($ipprc->file_exists($compUri));
    126127
    127128    if ($no_update || $no_op) {
    128         print STDERR "NOUPDATE: $database_command\n";
     129        print STDERR "NOUPDATE: $database_command\n";
    129130    }
    130131    else {
    131         ($success, $error_code, $full_buf, $stdout_buf, $stderr_buf) =
    132             run(command => $database_command, verbose => $verbose);
    133         unless ($success) {
    134             $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
    135             &my_die("Unable to update database file: $uri -> $compUri: $error_code",
    136                     $exp_id,$exp_name,$class_id,$uri, $PS_EXIT_SYS_ERROR);
    137         }
     132        ($success, $error_code, $full_buf, $stdout_buf, $stderr_buf) =
     133            run(command => $database_command, verbose => $verbose);
     134        unless ($success) {
     135            $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
     136            &my_die("Unable to update database file: $uri -> $compUri: $error_code",
     137                    $exp_id,$exp_name,$class_id,$uri, $PS_EXIT_SYS_ERROR);
     138        }
    138139    }
    139140    exit(0);
     
    149150    # Confirm we have both files
    150151    &my_die("Couldn't find original file: $uri\n", $exp_id,$exp_name,$class_id,$uri,$PS_EXIT_SYS_ERROR)
    151         unless($ipprc->file_exists($uri));
     152        unless($ipprc->file_exists($uri));
    152153    my $uriReal = $ipprc->file_resolve( $uri );
    153    
     154
    154155    my $compUri = $uri . ".fz";
    155156    unless($ipprc->file_exists($compUri)) {
    156         &my_die("Couldn't find compressed version of the file: $compUri\n",
    157                 $exp_id,$exp_name,$class_id,$uri,$PS_EXIT_SYS_ERROR);
    158 
    159         # If that die is removed, this will compress things as well.
    160         #
    161 #       &my_die("Output compressed file already exists: $compUri\n",
    162 #               $exp_id,$exp_name,$class_id,$uri,$PS_EXIT_SYS_ERROR)
    163 #           if ($ipprc->file_exists($compUri));
    164 #       my $compReal= $ipprc->file_resolve( $compUri, 'create');
    165        
    166 #       my $compress_command = "$fpack -h -s 8 -S $uriReal >  $compReal";
    167 #       print STDERR "$compReal $uriReal $compress_command\n";
    168 #       my ($success, $error_code, $full_buf, $stdout_buf, $stderr_buf) =
    169 #           run(command => $compress_command, verbose => $verbose);
    170 #       unless ($success) {
    171 #           $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
    172 #           &my_die("Unable to compress file: $uri -> $compUri: $error_code",
    173 #                   $exp_id,$exp_name,$class_id,$uri, $PS_EXIT_SYS_ERROR);
    174 #       }
     157        &my_die("Couldn't find compressed version of the file: $compUri\n",
     158                $exp_id,$exp_name,$class_id,$uri,$PS_EXIT_SYS_ERROR);
     159
     160        # If that die is removed, this will compress things as well.
     161        #
     162#       &my_die("Output compressed file already exists: $compUri\n",
     163#               $exp_id,$exp_name,$class_id,$uri,$PS_EXIT_SYS_ERROR)
     164#           if ($ipprc->file_exists($compUri));
     165#       my $compReal= $ipprc->file_resolve( $compUri, 'create');
     166
     167#       my $compress_command = "$fpack -h -s 8 -S $uriReal >  $compReal";
     168#       print STDERR "$compReal $uriReal $compress_command\n";
     169#       my ($success, $error_code, $full_buf, $stdout_buf, $stderr_buf) =
     170#           run(command => $compress_command, verbose => $verbose);
     171#       unless ($success) {
     172#           $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
     173#           &my_die("Unable to compress file: $uri -> $compUri: $error_code",
     174#                   $exp_id,$exp_name,$class_id,$uri, $PS_EXIT_SYS_ERROR);
     175#       }
    175176    }
    176177
     
    181182
    182183    unless ($no_op) {
    183         $neb->replicate($compUri);
    184         $neb->swap($uri,$compUri) or
    185             &my_die("Nebulous swap failed between $uri and $compUri",
    186                     $exp_id,$exp_name,$class_id,$uri,$PS_EXIT_SYS_ERROR);
    187     }
    188     # Update database 
     184        $neb->replicate($compUri);
     185        $neb->swap($uri,$compUri) or
     186            &my_die("Nebulous swap failed between $uri and $compUri",
     187                    $exp_id,$exp_name,$class_id,$uri,$PS_EXIT_SYS_ERROR);
     188    }
     189    # Update database
    189190
    190191    my $database_command = "$regtool -updateprocessedimfile -exp_id $exp_id -class_id $class_id -set_state lossy ";
     
    192193
    193194    $database_command .= " -dbname $dbname" if defined $dbname;
    194    
     195
    195196    if ($no_update || $no_op) {
    196         print STDERR "NOUPDATE: $database_command\n";
     197        print STDERR "NOUPDATE: $database_command\n";
    197198    }
    198199    else {
    199         my ($success, $error_code, $full_buf, $stdout_buf, $stderr_buf) =
    200             run(command => $database_command, verbose => $verbose);
    201         unless($success) {
    202             $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
    203             $neb->swap($uri,$compUri) or
    204                 &my_die("DB update failed and Nebulous swap-back failed between $uri and $compUri",
    205                         $exp_id,$exp_name,$class_id,$uri,$PS_EXIT_SYS_ERROR);
    206             &my_die("Unable to update database file: $uri -> $compUri: $error_code",
    207                     $exp_id,$exp_name,$class_id,$uri, $PS_EXIT_SYS_ERROR);
    208         }
    209         # remove original version
     200        my ($success, $error_code, $full_buf, $stdout_buf, $stderr_buf) =
     201            run(command => $database_command, verbose => $verbose);
     202        unless($success) {
     203            $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
     204            $neb->swap($uri,$compUri) or
     205                &my_die("DB update failed and Nebulous swap-back failed between $uri and $compUri",
     206                        $exp_id,$exp_name,$class_id,$uri,$PS_EXIT_SYS_ERROR);
     207            &my_die("Unable to update database file: $uri -> $compUri: $error_code",
     208                    $exp_id,$exp_name,$class_id,$uri, $PS_EXIT_SYS_ERROR);
     209        }
     210        # remove original version
    210211    $neb->delete($compUri);
    211212    }
  • trunk/ippScripts/scripts/magic_destreak.pl

    r27396 r27718  
    88use Sys::Hostname;
    99my $host = hostname();
     10my $date = `date`;
    1011print "\n\n";
    11 print "Starting script $0 on $host\n\n";
     12print "Starting script $0 on $host at $date\n\n";
    1213
    1314use vars qw( $VERSION );
  • trunk/ippScripts/scripts/magic_destreak_cleanup.pl

    r27604 r27718  
    88use Sys::Hostname;
    99my $host = hostname();
     10my $date = `date`;
    1011print "\n\n";
    11 print "Starting script $0 on $host\n\n";
     12print "Starting script $0 on $host at $date\n\n";
    1213
    1314use vars qw( $VERSION );
  • trunk/ippScripts/scripts/magic_destreak_defineruns.pl

    r26030 r27718  
    1111use Sys::Hostname;
    1212my $host = hostname();
     13my $date = `date`;
    1314print "\n\n";
    14 print "Starting script $0 on $host\n\n";
     15print "Starting script $0 on $host at $date\n\n";
    1516
    1617use vars qw( $VERSION );
  • trunk/ippScripts/scripts/magic_destreak_revert.pl

    r27598 r27718  
    88use Sys::Hostname;
    99my $host = hostname();
     10my $date = `date`;
    1011print "\n\n";
    11 print "Starting script $0 on $host\n\n";
     12print "Starting script $0 on $host at $date\n\n";
    1213
    1314use vars qw( $VERSION );
  • trunk/ippScripts/scripts/magic_process.pl

    r27634 r27718  
    88use Sys::Hostname;
    99my $host = hostname();
     10my $date = `date`;
    1011print "\n\n";
    11 print "Starting script $0 on $host\n\n";
     12print "Starting script $0 on $host at $date\n\n";
    1213
    1314use vars qw( $VERSION );
  • trunk/ippScripts/scripts/magic_tree.pl

    r27596 r27718  
    88use Sys::Hostname;
    99my $host = hostname();
     10my $date = `date`;
    1011print "\n\n";
    11 print "Starting script $0 on $host\n\n";
     12print "Starting script $0 on $host at $date\n\n";
    1213
    1314use vars qw( $VERSION );
  • trunk/ippScripts/scripts/publish_file.pl

    r27286 r27718  
    77use Sys::Hostname;
    88my $host = hostname();
    9 print "Starting script $0 on $host\n\n";
     9my $date = `date`;
     10print "\n\n";
     11print "Starting script $0 on $host at $date\n\n";
    1012
    1113use DateTime;
  • trunk/ippScripts/scripts/rcserver_checkstatus.pl

    r25567 r27718  
    88use Sys::Hostname;
    99my $host = hostname();
     10my $date = `date`;
    1011print "\n\n";
    11 print "Starting script $0 on $host\n\n";
     12print "Starting script $0 on $host at $date\n\n";
    1213
    1314use vars qw( $VERSION );
  • trunk/ippScripts/scripts/receive_advance.pl

    r24127 r27718  
    77use Sys::Hostname;
    88my $host = hostname();
    9 print "Starting script $0 on $host\n\n";
     9my $date = `date`;
     10print "\n\n";
     11print "Starting script $0 on $host at $date\n\n";
    1012
    1113use DateTime;
  • trunk/ippScripts/scripts/receive_file.pl

    r25940 r27718  
    77use Sys::Hostname;
    88my $host = hostname();
    9 print "Starting script $0 on $host\n\n";
     9my $date = `date`;
     10print "\n\n";
     11print "Starting script $0 on $host at $date\n\n";
    1012
    1113use DateTime;
     
    124126    print "dirinfo resolved is: $resolved\n" if $verbose;
    125127
    126     open OUT, ">$resolved" 
     128    open OUT, ">$resolved"
    127129        or &my_die( "failed to open $resolved\n", $file_id, $PS_EXIT_UNKNOWN_ERROR);
    128130    print OUT @$dirinfo_lines
     
    130132    close OUT
    131133        or &my_die( "failed to close $resolved\n", $file_id, $PS_EXIT_UNKNOWN_ERROR);
    132    
     134
    133135    # update the fileset to allow processing of other files
    134136    my $command = "$receivetool -updatefileset -fileset_id $fileset_id";
     
    160162    &my_die( "failed to resolve $dbinfo_uri\n", $file_id, $PS_EXIT_UNKNOWN_ERROR) if !$resolved;
    161163
    162     open OUT, ">$resolved" 
     164    open OUT, ">$resolved"
    163165        or &my_die( "failed to open $resolved\n", $file_id, $PS_EXIT_UNKNOWN_ERROR);
    164166
     
    227229                $current_component = $value;
    228230                $component_dir = $components->{$current_component};
    229                 &my_die( "$component_dir is null for $value in $filename: $runType\n", 
     231                &my_die( "$component_dir is null for $value in $filename: $runType\n",
    230232                        $file_id, $PS_EXIT_UNKNOWN_ERROR) if !$component_dir;
    231233            } elsif ($name eq 'workdir') {
     
    237239                $new_value = basename($value);
    238240            } elsif ((($name eq 'uri') or ($name eq 'path_base')) and ($value ne 'NULL')) {
    239                 &my_die( "$component_dir is null and we need it for $name", 
     241                &my_die( "$component_dir is null and we need it for $name",
    240242                        $file_id, $PS_EXIT_PROG_ERROR) if !$component_dir;
    241243
  • trunk/ippScripts/scripts/receive_fileset.pl

    r24786 r27718  
    77use Sys::Hostname;
    88my $host = hostname();
    9 print "Starting script $0 on $host\n\n";
     9my $date = `date`;
     10print "\n\n";
     11print "Starting script $0 on $host at $date\n\n";
    1012
    1113use DateTime;
  • trunk/ippScripts/scripts/receive_setstatus.pl

    r24038 r27718  
    88use Sys::Hostname;
    99my $host = hostname();
     10my $date = `date`;
    1011print "\n\n";
    11 print "Starting script $0 on $host\n\n";
     12print "Starting script $0 on $host at $date\n\n";
    1213
    1314use vars qw( $VERSION );
     
    7475        $fileargs = " --list - --copy --abspath";
    7576    }
    76        
     77
    7778    # XXX need to create a fileset type for this
    7879    my $command = "echo $regline | dsreg --add $status_fs_name --product $status_product --type notset";
  • trunk/ippScripts/scripts/receive_source.pl

    r24744 r27718  
    77use Sys::Hostname;
    88my $host = hostname();
    9 print "Starting script $0 on $host\n\n";
     9my $date = `date`;
     10print "\n\n";
     11print "Starting script $0 on $host at $date\n\n";
    1012
    1113use DateTime;
  • trunk/ippScripts/scripts/register_exp.pl

    r23688 r27718  
    88use Sys::Hostname;
    99my $host = hostname();
     10my $date = `date`;
    1011print "\n\n";
    11 print "Starting script $0 on $host\n\n";
     12print "Starting script $0 on $host at $date\n\n";
    1213
    1314use vars qw( $VERSION );
  • trunk/ippScripts/scripts/register_imfile.pl

    r26378 r27718  
    88use Sys::Hostname;
    99my $host = hostname();
     10my $date = `date`;
    1011print "\n\n";
    11 print "Starting script $0 on $host\n\n";
     12print "Starting script $0 on $host at $date\n\n";
    1213
    1314use vars qw( $VERSION );
     
    115116    my $burntoolStateGood = 0;
    116117    foreach my $line (split /\n/, $out1) {
    117         if ($line =~ /FPA.BURNTOOL.APPLIED/) {
    118             $line =~ s/^\s+//;
    119             $burntoolState = (split /\s+/, $line)[2];
    120         }
    121         if ($line =~ /FPA.CAMERA/) {
    122             $line =~ s/^\s+//;
    123             if ((split /\s+/, $line)[2] eq 'GPC1') {
    124                 $isGPC1 = 1;
    125             }
    126         }
     118        if ($line =~ /FPA.BURNTOOL.APPLIED/) {
     119            $line =~ s/^\s+//;
     120            $burntoolState = (split /\s+/, $line)[2];
     121        }
     122        if ($line =~ /FPA.CAMERA/) {
     123            $line =~ s/^\s+//;
     124            if ((split /\s+/, $line)[2] eq 'GPC1') {
     125                $isGPC1 = 1;
     126            }
     127        }
    127128    }
    128129    if ($isGPC1 != 1) {
    129         $burntoolState = 0; # If it's not GPC1, you shouldn't have run burntool.
     130        $burntoolState = 0; # If it's not GPC1, you shouldn't have run burntool.
    130131    }
    131132    elsif (($isGPC1 == 1) && ($burntoolState == 1)) {
    132 #       print STDERR "In the good region: >>$burntoolState<<\n";
    133         my $ppConfigDump_cmd = "$ppConfigDump -camera GPC1 -dump-camera -";
    134         my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    135             IPC::Cmd::run(command => $ppConfigDump_cmd, verbose => $verbose);
    136         unless ($success) {
    137             $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
    138             warn ("Unable to perform ppConfigDump");
    139             exit($error_code);
    140         }
    141 
    142         # This is ugly, but doing a full parse for one entry is a bit wasteful.
    143         foreach my $line (split /\n/, (join "", @$stdout_buf)) {
    144             if ($line =~ /BURNTOOL.STATE.GOOD/) {
    145                 $line =~ s/^\s+//;
    146                 $burntoolStateGood = (split /\s+/, $line)[2];
    147                 last;
    148             }
    149         }
    150         $burntoolState = $burntoolStateGood; # Positive because this has the header table.
    151        
     133#       print STDERR "In the good region: >>$burntoolState<<\n";
     134        my $ppConfigDump_cmd = "$ppConfigDump -camera GPC1 -dump-camera -";
     135        my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
     136            IPC::Cmd::run(command => $ppConfigDump_cmd, verbose => $verbose);
     137        unless ($success) {
     138            $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
     139            warn ("Unable to perform ppConfigDump");
     140            exit($error_code);
     141        }
     142
     143        # This is ugly, but doing a full parse for one entry is a bit wasteful.
     144        foreach my $line (split /\n/, (join "", @$stdout_buf)) {
     145            if ($line =~ /BURNTOOL.STATE.GOOD/) {
     146                $line =~ s/^\s+//;
     147                $burntoolStateGood = (split /\s+/, $line)[2];
     148                last;
     149            }
     150        }
     151        $burntoolState = $burntoolStateGood; # Positive because this has the header table.
     152
    152153    }
    153154    $cmdflags .= " -burntool_state $burntoolState ";
  • trunk/ippScripts/scripts/stack_skycell.pl

    r27180 r27718  
    88use Sys::Hostname;
    99my $host = hostname();
     10my $date = `date`;
    1011print "\n\n";
    11 print "Starting script $0 on $host\n\n";
     12print "Starting script $0 on $host at $date\n\n";
    1213
    1314use DateTime;
  • trunk/ippScripts/scripts/tdl_generate.pl

    r21202 r27718  
    1313use Sys::Hostname;
    1414my $host = hostname();
     15my $date = `date`;
    1516#print "\n\n";
    16 #print "Starting script $0 on $host\n\n";
     17#print "Starting script $0 on $host at $date\n\n";
    1718
    1819use vars qw( $VERSION );
     
    5859# resolve any path:// or file:// in outroot
    5960$outroot = $ipprc->file_resolve($outroot);
    60    
     61
    6162# Look for programs we need
    6263my $missing_tools;
  • trunk/ippScripts/scripts/warp_overlap.pl

    r23688 r27718  
    88use Sys::Hostname;
    99my $host = hostname();
     10my $date = `date`;
    1011print "\n\n";
    11 print "Starting script $0 on $host\n\n";
     12print "Starting script $0 on $host at $date\n\n";
    1213
    1314use vars qw( $VERSION );
  • trunk/ippScripts/scripts/warp_skycell.pl

    r27180 r27718  
    77use Sys::Hostname;
    88my $host = hostname();
     9my $date = `date`;
    910print "\n\n";
    10 print "Starting script $0 on $host\n\n";
     11print "Starting script $0 on $host at $date\n\n";
    1112
    1213use DateTime;
Note: See TracChangeset for help on using the changeset viewer.