IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

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

Add date of processing to output log.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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";
Note: See TracChangeset for help on using the changeset viewer.