IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jan 11, 2015, 2:05:35 PM (12 years ago)
Author:
eugene
Message:

merge changes from trunk

Location:
branches/eam_branches/ipp-20140904
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20140904

  • branches/eam_branches/ipp-20140904/ippScripts/scripts/permcheck.pl

    r37139 r37804  
    2121#my $regtool  = can_run('regtool') or (warn "Can't find regtool" and $missing_tools = 1);
    2222my $camtool = can_run('camtool') or (warn "Can't find camtool" and $missing_tools = 1);
     23my $warptool = can_run('warptool') or (warn "Can't find warptool" and $missing_tools = 1);
    2324my $stacktool = can_run('stacktool') or (warn "Can't find stacktool" and $missing_tools = 1);
    2425my $staticskytool = can_run('staticskytool') or (warn "Can't find staticskytool" and $missing_tools = 1);
     
    4142pod2usage( -msg => "Required options: --dbname", -exitval => 2 )
    4243    unless $dbname;
    43 pod2usage( -msg => "Required options: --stage [camera|stack|skycal]", -exitval => 2 )
     44pod2usage( -msg => "Required options: --stage [camera|warp|stack|skycal]", -exitval => 2 )
    4445    unless $stage;
    4546pod2usage( -msg => "missing key", exitval => 2 )
     
    5859                           'ippb06' => 1
    5960);
     61
     62if ($stage eq 'warp') { # These things are destined to have their only copy on the stsciXX nodes.
     63    %backup_hosts = ('stsci00' => 1, 'stsci01' => 1, 'stsci02' => 1,
     64                     'stsci03' => 1, 'stsci04' => 1, 'stsci05' => 1, 'stsci06' => 1,
     65                     'stsci07' => 1, 'stsci08' => 1, 'stsci09' => 1,
     66                     'stsci10' => 1, 'stsci11' => 1, 'stsci12' => 1,
     67                     'stsci13' => 1, 'stsci14' => 1, 'stsci15' => 1, 'stsci16' => 1,
     68                     'stsci17' => 1, 'stsci18' => 1, 'stsci19' => 1);
     69    %backup_destinations = %backup_hosts;
     70}
     71
    6072my $backup_Nvols = 3;
    6173
     
    113125        &my_die("Unable to parse metadata from stagetool", $stage_id);
    114126}
     127elsif ($stage eq 'warp') {
     128    my $cmd = "$warptool -warped -warp_id $stage_id -dbname $dbname";
     129    my ($success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
     130        run(command => $cmd, verbose => 0);
     131    unless ($success) {
     132        $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
     133        &my_die("Unable to perform stagetool: $error_code", $stage_id);
     134    }
     135    $files = $mdcParser->parse_list(join "", @$stdout_buf) or
     136        &my_die("Unable to parse metadata from stagetool", $stage_id);
     137}
    115138
    116139my %components = ('camera' => ['PSASTRO.OUTPUT','PSASTRO.OUTPUT.MASK'],
     140                  'warp'   => ['PSWARP.OUTPUT','PSWARP.OUTPUT.MASK','PSWARP.OUTPUT.VARIANCE'],
    117141                  'stack'  => ['PPSTACK.UNCONV.COMP','PPSTACK.UNCONV.MASK.COMP','PPSTACK.UNCONV.VARIANCE.COMP',
    118142                               'PPSTACK.UNCONV.EXP','PPSTACK.UNCONV.EXPNUM','PPSTACK.UNCONV.EXPWT.COMP'],
     
    124148    my $data_state = $entry->{state};
    125149    my $hostname = $entry->{hostname};
     150    my $quality  = $entry->{quality};
     151    if ($quality != 0) { next; }
     152    print "# $path_base $data_state $hostname $quality\n";
    126153    foreach my $product (@{ $components{$stage} }) {
    127154        my @keys = ();
     
    148175            my $stat = $neb->stat($key);
    149176            die "nebulous key: $key not found" unless $stat;   
    150             my $instances = $neb->find_instances($key, 'any');
     177            my $instances;
     178            eval {
     179                $instances = $neb->find_instances($key, 'any');
     180            };
     181            unless (defined($instances)) { print "## skipping due to zero instances\n"; next; }
    151182            die "no instances found" unless $instances;   
    152183           
     
    256287                    $quality[0] = 1;
    257288                    print "cp $good_file $diskfiles[0]\n";
    258                     system("cp $good_file $diskfiles[0]");
     289                    vsystem("cp $good_file $diskfiles[0]");
    259290                }
    260291                # Begin my best validation thought
     
    275306                    if ($md5sums[$i] eq $md5sum) { # Found it.
    276307                        print "cp $diskfiles[$i] $diskfiles[0]\n";
    277                         system("cp $diskfiles[$i] $diskfiles[0]");
     308                        vsystem("cp $diskfiles[$i] $diskfiles[0]");
    278309                        # Begin my best validation thought
    279310                        {
     
    291322            if ($Ngood == 1) { # We have only one version
    292323                if ($quality_mask & 1) { # ANd it's on a backup volume
    293                     print "neb-replicate $key\n";
    294                     if ($do_ops) {
    295                         $neb->replicate($key) or die "failed to replicate the single valid copy";
    296                         if ($@) { die $@; }
     324                    if ($user_copies > 1) { # And we want more than one copy.
     325                        print "neb-replicate $key\n";
     326                        if ($do_ops) {
     327                            $neb->replicate($key) or die "failed to replicate the single valid copy";
     328                            if ($@) { die $@; }
     329                        }
    297330                    }
    298331                }
     
    305338                       
    306339                        # Begin my best validation thought
    307                         system("sync") == 0 or die "Couldn't sync?";
     340                        vsystem("sync") == 0 or die "Couldn't sync?";
    308341                        my $uris = $neb->find_instances($key,$rep_vol);
    309342                        @$uris = map {URI->new($_)->file if $_} @$uris;
     
    325358                       
    326359                        # Begin my best validation thought
    327                         system("sync") == 0 or die "Couldn't sync?";
     360                        vsystem("sync") == 0 or die "Couldn't sync?";
    328361                        my $uris = $neb->find_instances($key,$rep_vol);
    329362                        @$uris = map {URI->new($_)->file if $_} @$uris;
     
    343376                    }
    344377                }
    345                 for (my $i = 0; $i <= $#diskfiles; $i++) {
     378            }
     379#XXX NEW DEBUG THIS:  This should iterate over diskfiles that are not marked with a quality = 2, and cull them. 
     380# For the N>=2, we set that for the primary, and
     381# for both cases, we do not have a diskfile entry for the newly replicated copy. 
     382# Therefore, this should cull down to the correct number.
     383            for (my $i = 0; $i <= $#diskfiles; $i++) {
    346384#           print "$existance[$i] $quality[$i] $md5sums[$i] $md5sum $diskhosts[$i] $diskvols[$i]\n";
    347                     if ($quality[$i] != 1) {
    348                         if ($existance[$i] == 0) { # This disk file doesn't exist.
    349                             system("touch $diskfiles[$i]");
    350                         }
    351                         my $cull_vol = $diskhosts[$i] . "." . $diskvols[$i];
    352                         print "neb-cull --volume $cull_vol $key\n";
    353                         if ($do_ops) {
    354                             # The tilde here is to force hard volumes.  Don't touch it.
    355                             $neb->cull($key,"~${cull_vol}",2) or die "failed to cull a superfluous instance";
    356                             if ($@) { die "$@"; }
    357                         }
    358                     }
    359                 }
    360             }
     385                if ($quality[$i] != 1) {
     386                    if ($existance[$i] == 0) { # This disk file doesn't exist.
     387                        vsystem("touch $diskfiles[$i]");
     388                    }
     389                    my $cull_vol = $diskhosts[$i] . "." . $diskvols[$i];
     390                    print "neb-cull --volume $cull_vol $key\n";
     391                    if ($do_ops) {
     392                        # The tilde here is to force hard volumes.  Don't touch it.
     393                        $neb->cull($key,"~${cull_vol}",2) or die "failed to cull a superfluous instance";
     394                        if ($@) { die "$@"; }
     395                    }
     396                }
     397            }
     398            # }
    361399        } # end keys for this product
    362400    } # end product for this entry
    363401} # end entry for this id
     402
     403sub vsystem {
     404    my $cmd = shift;
     405    print "$cmd\n";
     406    if ($do_ops) {
     407        system($cmd);
     408    }
     409}
    364410
    365411sub local_md5sum {
     
    379425
    380426
     427
    381428sub parse_volume {
    382429    my $filename = shift(@_);
Note: See TracChangeset for help on using the changeset viewer.