IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 39987


Ignore:
Timestamp:
Feb 24, 2017, 5:37:58 PM (9 years ago)
Author:
watersc1
Message:

Merge from trunk of rawcheck.pl with prescan to skip completed components.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tags/ipp-20150312/ippScripts/scripts/rawcheck.pl

    r39943 r39987  
    171171# die;
    172172# Pull data from the gpc1 database about the exposure to consider
     173
    173174my $verbose = 0;
    174175my $mdcParser = PS::IPP::Metadata::Config->new;
    175176
    176 print("$regtool -processedimfile -exp_id $exp_id -dbname $dbname");
     177print("$regtool -processedimfile -exp_id $exp_id -dbname $dbname\n");
    177178my $regtool_cmd = "$regtool -processedimfile -exp_id $exp_id -dbname $dbname";
    178179my ($success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
     
    188189my $timer = time();
    189190print "## rawcheck.pl: $exp_id $dbname $do_cull $do_ops $timer_start\n";
     191# Do prescan checks.
     192if ($#{ $imfiles } > 0) {
     193    my @to_do_imfiles = ();
     194    my $prior_imfile;
     195    my $append = 0;
     196
     197    foreach my $imfile (@$imfiles) {
     198        my $key        = $imfile->{uri};
     199        my $data_state = $imfile->{data_state};
     200        my $md5sum     = $imfile->{md5sum};
     201        my $hostname   = $imfile->{hostname};
     202        my $class_id   = $imfile->{class_id};
     203       
     204        my $stat = $neb->stat($key);
     205        die "nebulous key: $key not found" unless $stat;   
     206        my $instances = $neb->find_instances($key, 'any');
     207        die "no instances found" unless $instances;   
     208        my @files = map {URI->new($_)->file if $_} @$instances;
     209       
     210        print ("\n#PRE: $key $data_state $md5sum $hostname $class_id T: $timer\n");
     211       
     212        my $has_itc_copy = 0;
     213        my @validation = ();
     214        for (my $i = 0; $i <= $#files; $i++) {
     215            # Check for itc copy.
     216            my ($instance_exists,$instance_md5sum,$instance_host,$instance_volume,$instance_site, $is_good);
     217            ($instance_host,$instance_volume) = parse_volume($files[$i]);
     218            $instance_site = $volume_map{$instance_volume};
     219           
     220            if ($instance_site eq 'ITC') {
     221                $has_itc_copy = 1;
     222            }
     223           
     224           
     225            $validation[$i] = sprintf("    % 3d %d %32s %s %s %s %s\n",
     226                                      -1,-1,"UNCHECKED",
     227                                      $files[$i],$instance_host,$instance_volume,$instance_site);
     228           
     229        }
     230        my $val_string = join('',@validation);
     231        print "$val_string";
     232       
     233        if ($append == 0) {
     234            if ($has_itc_copy == 0) {
     235                if (defined($prior_imfile)) {
     236                    push @to_do_imfiles, $prior_imfile;
     237                }
     238                $append = 1;
     239            }
     240        }
     241       
     242        if ($append == 1) {
     243            push @to_do_imfiles, $imfile;
     244        }
     245        printf( "#PRE_RESULT: %2d %2d %2d %2d\n",$has_itc_copy,$append,$#to_do_imfiles,$#{ $imfiles });
     246        $prior_imfile = $imfile;
     247    }
     248   
     249    @$imfiles = @to_do_imfiles;     
     250}
     251# End prescan checks.
     252
    190253# Loop over the imfiles of this exposure.
    191254foreach my $imfile (@$imfiles) {
     
    229292            $instance_exists = 1;
    230293            $existing_copies++;
     294            if ($instance_site eq 'ITC') {  # This is here to force checking of ITC copy.
     295                $continue_checking_md5sums = 1;
     296            }
    231297            if ($continue_checking_md5sums == 1) { #unsafe
    232298                $instance_md5sum = local_md5sum($files[$i]);
Note: See TracChangeset for help on using the changeset viewer.