IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 36458


Ignore:
Timestamp:
Jan 21, 2014, 10:29:30 AM (12 years ago)
Author:
bills
Message:

from trunk. Deal with missing convovled stack images, compressed log files, and
some changes for stack_summary stage.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tags/ipp-20130712/ippScripts/scripts/dist_bundle.pl

    r36224 r36458  
    5050                     'PPSUB.INVERSE.MASK' => 'inv_mask',
    5151                     'PPSUB.INVERSE.VARIANCE' => 'inv_variance' );
    52 my %stack_cleaned = ( 'PPSTACK.OUTPUT' => 'image',
     52
     53my %stack_cleaned = ( 'PPSTACK.UNCONV' => 'image',
     54                      'PPSTACK.UNCONV.MASK' => 'mask',
     55                      'PPSTACK.UNCONV.VARIANCE' => 'variance',
     56                      'PPSTACK.UNCONV.EXP' => 'exp',
     57                      'PPSTACK.UNCONV.EXPNUM' => 'expnum',
     58                      'PPSTACK.UNCONV.EXPWT' => 'expwt'
     59                      );
     60
     61my %stack_convolved = ( 'PPSTACK.OUTPUT' => 'image',
    5362                      'PPSTACK.OUTPUT.MASK' => 'mask',
    54                       'PPSTACK.OUTPUT.VARIANCE' => 'variance' );
    55 my %sky_cleaned   = ( 'PSPHOT.STACK.OUTPUT.IMAGE' => 'image',
    56                       'PSPHOT.STACK.OUTPUT.MASK' => 'mask',
    57                       'PSPHOT.STACK.OUTPUT.VARIANCE' => 'variance' );
     63                      'PPSTACK.OUTPUT.VARIANCE' => 'variance',
     64                      'PPSTACK.OUTPUT.EXP' => 'exp',
     65                      'PPSTACK.OUTPUT.EXPNUM' => 'expnum',
     66                      'PPSTACK.OUTPUT.EXPWT' => 'expwt'
     67                      );
     68my %empty_cleaned = ();
     69
    5870
    5971
     
    110122    defined $outroot;
    111123
     124$no_magic = 1;
     125
    112126if ($stage eq 'raw' and !$clean and !$no_magic) {
    113127   
     
    134148my $file_list = get_file_list($stage, $component, $path_base, $clean, $num_sky_inputs);
    135149
    136 if (($stage ne 'raw') and ($stage ne 'fake') and !$poor_quality) {
     150if (($stage ne 'raw') and ($stage ne 'fake') and ($stage ne 'stack_summary') and !$poor_quality) {
    137151    # If the file list is empty it is an error because we should at least get a config dump file
    138     # except for fake stage which doesn't do anything yet
     152    # except for fake stage which doesn't do anything yet, stack_summary stage, and of course raw files have
     153    # no config dump because they aren't processed
    139154    &my_die("empty file list", $component, $PS_EXIT_CONFIG_ERROR) if (!scalar @$file_list);
    140155}
     
    165180    my $image_type = get_image_type($stage, $file_rule);
    166181
     182    # skip useless empty trace files
     183    next if ($file_rule =~ /TRACE/);
     184
    167185    # if this is an image and we are building a clean bundle or if quality is bad skip this rule
    168186    next if $image_type and ($clean or $poor_quality);
     187
     188    if ($stage eq 'stack') {
     189        # skip convolved stacks since they are deleted just after they are created now
     190        next if $stack_convolved{$file_rule};
     191    }
    169192
    170193    # if magic is required, don't ship jpegs or binned fits images
     
    180203
    181204    my $file_name = $file->{name};
    182     my $base = basename($file_name);
    183205    my $path = $ipprc->file_resolve($file_name);
     206
     207    if (!$path and $file_rule =~ /LOG/) {
     208        my $compressed_file_name = $file_name . '.bz2';
     209        my $compressed_path = $ipprc->file_resolve($compressed_file_name);
     210        if ($compressed_path) {
     211            $path = $compressed_path;
     212            $file_name = $compressed_file_name;
     213        }
     214    }
     215
    184216
    185217    if (!$path) {
     
    194226        # XXX: perhaps only do this for stages where we know that this happens
    195227        next if $file_rule =~ /STATS/;
    196         # don't fail on these "non-essential files"
     228        # don't fail if these "non-essential files" are missing
     229        next if $file_rule =~ /LOG/;
    197230        next if $file_rule =~ /TRACE/;
    198         next if $file_rule =~ /LOG/;
    199231        next if $file_rule =~ /BIN/;
    200232
    201         # don't fail if cmf file is missing they are not regenerated on update
    202         next if ($stage eq 'chip' and $file_rule eq 'PSPHOT.OUTPUT');
     233        # chip stage cmf files are not regenerated after cleanup so don't complain if
     234        # they are missing. They are of limited utility anyways. USE the smfs
     235        next if ($stage eq 'chip' and $file_rule eq 'PSPHOT.OUTPUT');
    203236
    204237        &my_die("failed to resolve  $file_name", $component, $PS_EXIT_DATA_ERROR);
     
    235268        # create a symbolic link from the file in the nebulous repository
    236269        # in the temporary directory
    237         symlink $path, "$tmpdir/$base";
     270        symlink $path, "$tmpdir/" . basename($file_name);
    238271    }
    239272}
     
    463496    } elsif ($stage eq "stack") {
    464497        $type = $stack_cleaned{$rule};
    465     } elsif ($stage eq "sky") {
    466         $type = $sky_cleaned{$rule};
     498    } elsif ($stage eq "sky" or $stage eq 'skycal' or $stage eq 'stack_summary') {
     499        $type = $empty_cleaned{$rule};
    467500    } else {
    468501        &my_die("$stage is not a valid stage", $component, $PS_EXIT_CONFIG_ERROR);
     
    549582        $config_file_rule = "PPSTACK.CONFIG";
    550583    } elsif ($stage eq "sky") {
    551         if (1 or $num_sky_inputs > 1) {
    552             $config_file_rule = "PSPHOT.STACK.CONFIG";
    553         } else {
    554             $config_file_rule = "PSPHOT.SKY.CONFIG";
    555         }
     584        $config_file_rule = "PSPHOT.STACK.CONFIG";
     585    } elsif ($stage eq "skycal") {
     586        $config_file_rule = "PSASTRO.CONFIG";
     587    } elsif ($stage eq "stack_summary") {
     588        # stack_summary stage does not use a config dump file.
     589        return build_stack_summary_file_list($path_base, \@file_list);
    556590    } else {
    557591        &my_die("$stage is not a valid stage", $component, $PS_EXIT_CONFIG_ERROR);
     
    668702    if (!$num_inputs) {
    669703        $num_inputs = "undefined" if !defined $num_inputs;
    670         &my_die("unexpected number of static sky inputs $num_inputs",  $PS_EXIT_PROG_ERROR, $component, $error_code);
     704        &my_die("unexpected number of static sky inputs $num_inputs",  $component, $error_code);
    671705    }
    672706
    673707    return $num_inputs;
     708}
     709
     710# For stack_summary stage, we don't have a config dump file to give us the list of files.
     711# For now run neb-ls on the path base and take everything that matches.
     712sub build_stack_summary_file_list {
     713    my ($path_base, $file_list) = @_;
     714
     715    my $scheme = file_scheme($path_base);
     716
     717    if (!$scheme or $scheme ne 'neb') {
     718        &my_die("Building bundles for stack_summary not supported for no nebulous path_base.",
     719            $component, $PS_EXIT_PROG_ERROR);
     720    }
     721
     722    my $command = "neb-ls $path_base" . '%';
     723    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
     724        run(command => $command, verbose => $verbose);
     725    unless ($success) {
     726        $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
     727        &my_die("Unable to perform $command: $error_code", $component, $error_code);
     728    }
     729    my $nebls_output = join "", @$stdout_buf;
     730
     731    my @files = split "\n", $nebls_output;
     732
     733    my $i = 0;
     734    foreach my $f (@files) {
     735        my %file;
     736        $file{file_rule} = sprintf 'RULE.%d', $i++;
     737        $file{name} = 'neb://any/' . $f;
     738        push @$file_list, \%file;
     739    }
     740
     741    return $file_list;
    674742}
    675743
Note: See TracChangeset for help on using the changeset viewer.