IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Apr 9, 2009, 1:56:50 PM (17 years ago)
Author:
bills
Message:

change disttool -pendingcomponent to output "$outroot.$dist_id" as outdir to help make it unique
allow 'clean' raw stage distributions. (Database information only.) This is required to
support mirrors with chip stage and beyond images but not raw data

File:
1 edited

Legend:

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

    r23743 r23777  
    5858# Parse the command-line arguments
    5959my ($dist_id, $camera, $stage, $stage_id, $component, $path_base, $chip_path_base, $clean);
    60 my ($outroot, $run_state, $data_state, $magicked, $no_magic, $poor_quality);
     60my ($outdir, $run_state, $data_state, $magicked, $no_magic, $poor_quality);
    6161my ($dbname, $save_temps, $verbose, $no_update, $logfile);
    6262
     
    7171           'state=s'        => \$run_state,  # state of the run
    7272           'data_state=s'   => \$data_state, # data_state for this component
    73            'poor_quality'      => \$poor_quality,  # the processing for this component did not produced images
     73           'poor_quality'   => \$poor_quality,  # the processing for this component did not produced images
    7474           'no_magic'       => \$no_magic,   # magic is not required for this distribution run
    7575           'magicked'       => \$magicked,   # magicked state for this component
    76            'outroot=s'      => \$outroot,    # "directory" for outputs
     76           'outdir=s'       => \$outdir,     # "directory" for outputs
    7777           'clean'          => \$clean,      # create clean distribution
    7878           'save-temps'     => \$save_temps, # Save temporary files?
     
    8484
    8585pod2usage( -msg => "Unknown option: @ARGV", -exitval => 2 ) if @ARGV;
    86 pod2usage( -msg => "Required options: --dist_id --camera --stage --stage_id --component --path_base --outroot",
     86pod2usage( -msg => "Required options: --dist_id --camera --stage --stage_id --component --path_base --outdir",
    8787           -exitval => 3) unless
    8888    defined $dist_id and
     
    9292    defined $component and
    9393    defined $path_base and
    94     defined $outroot;
     94    defined $outdir;
    9595
    9696$ipprc->redirect_output($logfile) if $logfile;
    9797
    98 if (($stage eq 'raw') and !defined $chip_path_base) {
     98if (($stage eq 'raw') and !$clean and !defined $chip_path_base) {
    9999    pod2usage( -msg => "Required options: --chip_path_base for raw stage", -exitval => 3);
    100100}
     
    105105
    106106# making a clean bundle of raw images doesn't make sense
    107 if (($stage eq "raw") and $clean) {
    108     # well I suppose we could ship the registration log file. naw.
    109     &my_die("cannot create clean run at raw stage", $dist_id, $component, $PS_EXIT_CONFIG_ERROR);
    110 }
    111107
    112108# create the output directories if it is not a nebulous path and it doesn't exist
    113 if (index($outroot, "neb://") != 0) {
    114     if (! -e $outroot ) {
    115         my $code = system "mkdir -p $outroot";
    116         &my_die("cannot create output directory $outroot", $dist_id, $component,
     109if (index($outdir, "neb://") != 0) {
     110    if (! -e $outdir ) {
     111        my $code = system "mkdir -p $outdir";
     112        &my_die("cannot create output directory $outdir", $dist_id, $component,
    117113                $code >> 8) if $code;
    118114    }
     
    122118# note: We my_die in get_file_list if something goes wrong.
    123119
    124 my $file_list = get_file_list($stage, $component, $path_base);
    125 
    126 if ($stage ne 'fake') {
     120my $file_list = get_file_list($stage, $component, $path_base, $clean);
     121
     122if (($stage ne 'raw') and ($stage ne 'fake')) {
    127123    # If the file list is empty it is an error because we should at least get a config dump file
    128124    # except for fake stage which doesn't do anything yet
     
    132128# set up directory for temporary files
    133129
    134 my $tmpdir  = "$outroot/tmpdir.$dist_id.$component";
     130my $tmpdir  = "$outdir/tmpdir.$dist_id.$component";
    135131if (-e $tmpdir) {
    136132    if (-d $tmpdir) {
     
    155151
    156152# foreach my $file_rule (keys %$file_list) {
     153my $num_files = 0;
    157154foreach my $file (@$file_list) {
    158155    # check whether this file rule refers to an image, mask, or variance fits image
     
    188185    # we need to pre-process the image before adding to the bundle. Save the path names.
    189186    # the images will be created below
     187    $num_files++;
    190188    if ($image_type && $nan_masked_pixels) {
    191189        # save the
     
    251249my $bytes;
    252250my $md5sum;
    253 if ($stage eq 'fake') {
     251if (0) {
     252if (($stage eq 'fake')  or (($stage eq 'raw') and $clean)) {
    254253    open DUMMY, ">$tmpdir/fake.$component" or &my_die("Unable to create placeholder for fake component",
    255254        $dist_id, $component, $PS_EXIT_CONFIG_ERROR);
     
    257256    close DUMMY;
    258257}
    259 # create the tarfile
    260 {
     258}
     259if ($num_files) {
     260    # create the tarfile
    261261    # XXX TODO: create a file rule for the tar file name
    262262    my $tbase = basename($path_base);
    263263    $tbase .= ".$component" if $component;
    264264    $file_name = "$tbase.tgz";
    265     my $tarfile = "$outroot/$file_name";
     265    my $tarfile = "$outdir/$file_name";
    266266
    267267    my $command = "tar -C $tmpdir --owner=ipp --group=users -czhf $tarfile .";
     
    279279    &my_die("unable to compute md5sum for $tarfile", $dist_id, $component, $PS_EXIT_UNKNOWN_ERROR) if !$md5sum;
    280280
    281     my @finfo = stat($tarfile);
    282     &my_die("unable to stat $tarfile", $dist_id, $component, $PS_EXIT_UNKNOWN_ERROR) if !@finfo;
    283     $bytes = $finfo[7];
     281    $bytes = -s $tarfile;
    284282
    285283    delete_tmpdir($tmpdir);
     284} else {
     285    # no files for this component
     286    $file_name = "none";
     287    $bytes = 0;
     288    $md5sum = "0";
    286289}
    287290{
     
    360363    my $component = shift;
    361364    my $path_base = shift;
     365    my $clean = shift;
    362366
    363367    my @file_list;
     
    366370        # eventually rawImfile will have a path_base that we'll need to add '.fits'
    367371        # XXX do we want to distribute the registration log files?
    368         my %file;
    369         $file{file_rule} = "RAW.IMAGE";
    370         $file{name} = $path_base;
    371         push @file_list, \%file;
     372        if (!$clean) {
     373            my %file;
     374            $file{file_rule} = "RAW.IMAGE";
     375            $file{name} = $path_base;
     376            push @file_list, \%file;
     377        }
    372378        return \@file_list;
    373379    }
Note: See TracChangeset for help on using the changeset viewer.