IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 39986


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

Updated rawcheck.pl that attempts to check if it can skip any components if they've already been copied. The logic being that if components 1,2,3 have an ITC copy, but 4 doesn't, the error occurred on component 3, so only 3+ need to be checked. The prescan constructs a new array containing only these entries. This can be a problem with the md5sum checking, so all ITC copies get full md5sum calculations during the regular scan, so the initial copy of component 3 gets an md5sum (to find a valid copy), and whatever ITC copy of component 3 also gets an md5sum (to confirm the existing file is valid). Starting with component 4 this will switch back to checking only the initial copy (as there isn't a pre-existing ITC copy).

Tested on some previous failed exp_ids, and confirmed that the prescan is skipped entirely for ISP data (which have just the one component anyway).

File:
1 edited

Legend:

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

    r39985 r39986  
    175175my $mdcParser = PS::IPP::Metadata::Config->new;
    176176
    177 print("$regtool -processedimfile -exp_id $exp_id -dbname $dbname");
     177print("$regtool -processedimfile -exp_id $exp_id -dbname $dbname\n");
    178178my $regtool_cmd = "$regtool -processedimfile -exp_id $exp_id -dbname $dbname";
    179179my ($success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
     
    189189my $timer = time();
    190190print "## 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
    191253# Loop over the imfiles of this exposure.
    192254foreach my $imfile (@$imfiles) {
     
    230292            $instance_exists = 1;
    231293            $existing_copies++;
     294            if ($instance_site eq 'ITC') {  # This is here to force checking of ITC copy.
     295                $continue_checking_md5sums = 1;
     296            }
    232297            if ($continue_checking_md5sums == 1) { #unsafe
    233298                $instance_md5sum = local_md5sum($files[$i]);
Note: See TracChangeset for help on using the changeset viewer.