Changeset 37594 for trunk/ippScripts
- Timestamp:
- Nov 13, 2014, 4:12:26 PM (12 years ago)
- File:
-
- 1 edited
-
trunk/ippScripts/scripts/permcheck.pl (modified) (13 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippScripts/scripts/permcheck.pl
r37139 r37594 21 21 #my $regtool = can_run('regtool') or (warn "Can't find regtool" and $missing_tools = 1); 22 22 my $camtool = can_run('camtool') or (warn "Can't find camtool" and $missing_tools = 1); 23 my $warptool = can_run('warptool') or (warn "Can't find warptool" and $missing_tools = 1); 23 24 my $stacktool = can_run('stacktool') or (warn "Can't find stacktool" and $missing_tools = 1); 24 25 my $staticskytool = can_run('staticskytool') or (warn "Can't find staticskytool" and $missing_tools = 1); … … 41 42 pod2usage( -msg => "Required options: --dbname", -exitval => 2 ) 42 43 unless $dbname; 43 pod2usage( -msg => "Required options: --stage [camera| stack|skycal]", -exitval => 2 )44 pod2usage( -msg => "Required options: --stage [camera|warp|stack|skycal]", -exitval => 2 ) 44 45 unless $stage; 45 46 pod2usage( -msg => "missing key", exitval => 2 ) … … 58 59 'ippb06' => 1 59 60 ); 61 62 if ($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 60 72 my $backup_Nvols = 3; 61 73 … … 113 125 &my_die("Unable to parse metadata from stagetool", $stage_id); 114 126 } 127 elsif ($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 } 115 138 116 139 my %components = ('camera' => ['PSASTRO.OUTPUT','PSASTRO.OUTPUT.MASK'], 140 'warp' => ['PSWARP.OUTPUT','PSWARP.OUTPUT.MASK','PSWARP.OUTPUT.VARIANCE'], 117 141 'stack' => ['PPSTACK.UNCONV.COMP','PPSTACK.UNCONV.MASK.COMP','PPSTACK.UNCONV.VARIANCE.COMP', 118 142 'PPSTACK.UNCONV.EXP','PPSTACK.UNCONV.EXPNUM','PPSTACK.UNCONV.EXPWT.COMP'], … … 124 148 my $data_state = $entry->{state}; 125 149 my $hostname = $entry->{hostname}; 150 my $quality = $entry->{quality}; 151 if ($quality != 0) { next; } 152 print "# $path_base $data_state $hostname $quality\n"; 126 153 foreach my $product (@{ $components{$stage} }) { 127 154 my @keys = (); … … 148 175 my $stat = $neb->stat($key); 149 176 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; } 151 182 die "no instances found" unless $instances; 152 183 … … 256 287 $quality[0] = 1; 257 288 print "cp $good_file $diskfiles[0]\n"; 258 system("cp $good_file $diskfiles[0]");289 vsystem("cp $good_file $diskfiles[0]"); 259 290 } 260 291 # Begin my best validation thought … … 275 306 if ($md5sums[$i] eq $md5sum) { # Found it. 276 307 print "cp $diskfiles[$i] $diskfiles[0]\n"; 277 system("cp $diskfiles[$i] $diskfiles[0]");308 vsystem("cp $diskfiles[$i] $diskfiles[0]"); 278 309 # Begin my best validation thought 279 310 { … … 291 322 if ($Ngood == 1) { # We have only one version 292 323 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 } 297 330 } 298 331 } … … 305 338 306 339 # Begin my best validation thought 307 system("sync") == 0 or die "Couldn't sync?";340 vsystem("sync") == 0 or die "Couldn't sync?"; 308 341 my $uris = $neb->find_instances($key,$rep_vol); 309 342 @$uris = map {URI->new($_)->file if $_} @$uris; … … 325 358 326 359 # Begin my best validation thought 327 system("sync") == 0 or die "Couldn't sync?";360 vsystem("sync") == 0 or die "Couldn't sync?"; 328 361 my $uris = $neb->find_instances($key,$rep_vol); 329 362 @$uris = map {URI->new($_)->file if $_} @$uris; … … 343 376 } 344 377 } 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++) { 346 384 # 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 # } 361 399 } # end keys for this product 362 400 } # end product for this entry 363 401 } # end entry for this id 402 403 sub vsystem { 404 my $cmd = shift; 405 print "$cmd\n"; 406 if ($do_ops) { 407 system($cmd); 408 } 409 } 364 410 365 411 sub local_md5sum { … … 379 425 380 426 427 381 428 sub parse_volume { 382 429 my $filename = shift(@_);
Note:
See TracChangeset
for help on using the changeset viewer.
