IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 26044


Ignore:
Timestamp:
Nov 5, 2009, 10:22:11 AM (17 years ago)
Author:
bills
Message:

use a temporary file for output from dist_bundle.pl. stdout is too noisy

Location:
trunk/ippScripts/scripts
Files:
2 edited

Legend:

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

    r26042 r26044  
    88use Sys::Hostname;
    99my $host = hostname();
    10 print "\n\n";
    11 print "Starting script $0 on $host\n\n";
     10# print "\n\n";
     11# print "Starting script $0 on $host\n\n";
    1212
    1313use vars qw( $VERSION );
     
    6060# Parse the command-line arguments
    6161my ($camera, $stage, $stage_id, $component, $path_base, $chip_path_base, $clean);
    62 my ($outdir, $run_state, $data_state, $magicked, $no_magic, $poor_quality);
     62my ($outdir, $run_state, $data_state, $magicked, $no_magic, $poor_quality, $results_file);
    6363my ($dbname, $save_temps, $verbose, $no_update, $logfile);
    6464
    6565GetOptions(
     66           'results_file=s' => \$results_file,     # camera for evaluating file rules
    6667           'camera=s'       => \$camera,     # camera for evaluating file rules
    6768           'stage=s'        => \$stage,      # raw, chip, warp, or diff
     
    303304}
    304305
    305 print "bundleResults MULTI\n\n";
    306 print "bundleResults METADATA\n";
    307 print "   name      STR    $file_name\n";
    308 print "   bytes     S64    $bytes\n";
    309 print "   md5sum    STR    $md5sum\n";
    310 print "END\n\n";
     306if ($results_file) {
     307    open RF, ">$results_file" or &my_die("unable to open results file $results_file", $component, $PS_EXIT_UNKNOWN_ERROR);
     308    print RF "bundleResults MULTI\n\n";
     309    print RF "bundleResults METADATA\n";
     310    print RF "   name      STR    $file_name\n";
     311    print RF "   bytes     S64    $bytes\n";
     312    print RF "   md5sum    STR    $md5sum\n";
     313    print RF "END\n\n";
     314
     315    close RF;
     316}
    311317
    312318exit 0;
  • trunk/ippScripts/scripts/dist_component.pl

    r26043 r26044  
    8383my $mdcParser = PS::IPP::Metadata::Config->new; # Parser for metadata config files
    8484
     85my ($rf, $rf_name) = tempfile("/tmp/bundleresults.$dist_id.$component.XXXX", UNLINK => !$save_temps);
     86close $rf;
     87
    8588my ($file_name, $bytes, $md5sum);
    8689{
    8790    my $command = "$dist_make_bundle --camera $camera --stage $stage --stage_id $stage_id";
     91    $command .= " --results_file $rf_name";
    8892    $command .= " --component $component --path_base $path_base --outdir $outdir";
    8993    $command .= " --chip_path_base $chip_path_base" if $chip_path_base;
     
    105109    }
    106110
    107     # parse stdout_buf to get ($file_name, $bytes, $md5sum);
    108     my $metadata = $mdcParser->parse (join "", @$stdout_buf) or
     111    open $rf, "<$rf_name" or &my_die("failed to open results file $rf_name", $dist_id, $component, $PS_EXIT_UNKNOWN_ERROR);
     112
     113    my @lines = (<$rf>);
     114
     115    my $metadata = $mdcParser->parse (join "", @lines) or
    109116        &my_die("Unable to parse metadata config doc", $dist_id, $component, $PS_EXIT_PROG_ERROR);
     117
    110118    my $results = parse_md_list($metadata);
    111119
     
    114122        &my_die("Unexected number of results from dist_make_bundle.pl: $n", $dist_id, $component, $PS_EXIT_PROG_ERROR);
    115123    }
     124    my $result = $results->[0];
    116125
    117     $file_name = $results->{name};
     126    $file_name = $result->{name};
    118127    &my_die("undefined file name from dist_bundle.pl", $dist_id, $component, $PS_EXIT_PROG_ERROR) unless defined $file_name;
    119128
    120     $bytes = $results->{bytes};
     129    $bytes = $result->{bytes};
    121130    &my_die("undefined file size from dist_bundle.pl", $dist_id, $component, $PS_EXIT_PROG_ERROR) unless defined $bytes;
    122131
    123     $md5sum = $results->{md5sum};
     132    $md5sum = $result->{md5sum};
    124133    &my_die("undefined file md5sum from dist_bundle.pl", $dist_id, $component, $PS_EXIT_PROG_ERROR) unless defined $md5sum;
    125134}
Note: See TracChangeset for help on using the changeset viewer.