Changeset 38682 for trunk/tools
- Timestamp:
- Aug 24, 2015, 5:35:11 PM (11 years ago)
- Location:
- trunk/tools/stsci_disks
- Files:
-
- 4 edited
-
p0_large.pl (modified) (3 diffs)
-
p1_clear.pl (modified) (5 diffs)
-
p2_check.pl (modified) (2 diffs)
-
p3_permcheck.pl (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/stsci_disks/p0_large.pl
r38647 r38682 76 76 77 77 my $time = time(); 78 my $logDest = "neb://any/stsci_shuffle/ large/${host}.${volume}/${dir}.log.${time}";78 my $logDest = "neb://any/stsci_shuffle/sizes/${host}.${volume}/${dir}.log"; 79 79 my $ipprc = PS::IPP::Config->new( "GPC1" ) or die "Could not create config object.\n"; 80 80 $ipprc->redirect_output($logDest) or die "Could not redirect output to logfile ${logDest}\n"; … … 104 104 my $root = "/data/${host}.${volume}/nebulous/${dir}"; 105 105 my @subdirectories = <$root/*>; 106 my $size = 0; 107 my $limit = 10 * 1024 * 1024; # stat returns bytes, so 100 * meg * k 108 my ($size_ota,$size_pv1,$size_pv2,$size_md) = (0,0,0,0); 106 109 foreach my $subdir (@subdirectories) { 107 110 my @files = <${subdir}/*>; … … 110 113 111 114 my @stat = stat($f); 112 my $limit = 10 * 1024 * 1024; # stat returns bytes, so 100 * meg * k115 $size += $stat[7]; 113 116 # print "$f $stat[7]\n"; die; 114 if ($ stat[7] > $limit) {115 my $ins_id = $f;116 $ins_id =~ s/^$subdir\///;117 $ins_id =~ s/\..*//;117 if ($f =~ /ota/) { $size_ota += $stat[7]; } 118 if ($f =~ /LAP.ThreePi.20120706/) { $size_pv1 += $stat[7]; } 119 if ($f =~ /LAP.ThreePi.20130717/) { $size_pv2 += $stat[7]; } 120 if ($f =~ /MD/) { $size_md += $stat[7]; } 118 121 119 my $key = $f; 120 $key =~ s/.*\/${ins_id}\.//; 121 $key =~ s%:%/%g; 122 123 # if ($stat[7] > $limit) { 124 # if (0) { 125 # my $ins_id = $f; 126 # $ins_id =~ s/^$subdir\///; 127 # $ins_id =~ s/\..*//; 122 128 123 my $uris = $neb->find_instances($key); 124 my $found = 0; 125 foreach my $uri (@{ $uris }) { 126 if ($uri eq "file://${f}") { 127 $found = 1; 128 } 129 } 130 if ($#{ $uris } == -1) { # true orphan 131 if ($key =~ /ecliptic/) { 132 $key =~ s%/00hr%:00hr%; 133 $neb->replicate($key); 134 print "#replicate $key\n"; 135 } 136 $found = -1; 137 } 138 print "$f $stat[7] $key $found\n"; 139 if ($found == 0) { 140 # print "rm $f\n"; 141 unlink($f); 142 foreach my $rsync (@rsync_vols) { 143 my $test_f = $f; 144 $test_f =~ s%^/data/%%; 145 $test_f = "/data/${rsync}/stsci_shuffle/${test_f}"; 146 if (-e $test_f) { 147 unlink($f); 148 # print "rm $test_f\n"; 149 } 150 } 151 } 152 } 129 # my $key = $f; 130 # $key =~ s/.*\/${ins_id}\.//; 131 # $key =~ s%:%/%g; 132 133 # my $uris = $neb->find_instances($key); 134 # my $found = 0; 135 # foreach my $uri (@{ $uris }) { 136 # if ($uri eq "file://${f}") { 137 # $found = 1; 138 # } 139 # } 140 # if ($#{ $uris } == -1) { # true orphan 141 # if ($key =~ /ecliptic/) { 142 # $key =~ s%/00hr%:00hr%; 143 # $neb->replicate($key); 144 # print "#replicate $key\n"; 145 # } 146 # $found = -1; 147 # } 148 # print "$f $stat[7] $key $found\n"; 149 # if ($found == 0) { 150 # # print "rm $f\n"; 151 # unlink($f); 152 # foreach my $rsync (@rsync_vols) { 153 # my $test_f = $f; 154 # $test_f =~ s%^/data/%%; 155 # $test_f = "/data/${rsync}/stsci_shuffle/${test_f}"; 156 # if (-e $test_f) { 157 # unlink($f); 158 # # print "rm $test_f\n"; 159 # } 160 # } 161 # } 162 # } 163 # } 153 164 } 154 # print STDERR "$subdir\n";155 165 } 166 my $Msize = $size / 1024 / 1024; 167 print "$root $size $Msize\n"; 168 print "OTA $size_ota\n"; 169 print "PV1 $size_pv1\n"; 170 print "PV2 $size_pv2\n"; 171 print "MD $size_md\n"; 172 -
trunk/tools/stsci_disks/p1_clear.pl
r38364 r38682 51 51 defined $host && defined $volume && defined $dir && 52 52 defined $db && defined $dbhost && defined $dbuser && defined $dbpass; 53 54 my $host_check = `hostname`; 55 chomp($host_check); 56 if ($host ne $host_check) { 57 die "Required to run on $host. not on $host_check\n"; 58 } 53 59 54 60 my $dbh = DBI->connect( … … 125 131 } 126 132 127 $md5sums[$i] = local_md5sum($f);133 $md5sums[$i] = actual_local_md5sum($f); 128 134 unless (defined($md5sums[$i])) { 129 135 die("Failed to calculate md5sum locally. $f "); … … 218 224 if (defined($vols[$i])) { 219 225 # print "HERE: $keys[$i] $host $volume\n"; 220 $neb->cull($keys[$i],$host . "." . $volume); 226 eval { 227 $neb->cull($keys[$i],$host . "." . $volume); 228 }; 229 warn "CULL ERROR: $@" if $@; 221 230 } 222 231 else { … … 282 291 }; 283 292 293 if (defined($vol_host)) { 294 if ($vol_host eq 'ipp066') { 295 $vol_host = get_volume($key); 296 if ($vol_host eq 'ipp066') { 297 # Really? 298 $vol_host = get_volume($key); 299 # if ($vol_host eq 'ipp066') {} #fine. Be that way. Jerk. 300 # 301 } 302 } 303 } 284 304 return($vol_host); 285 305 } … … 326 346 return($sum); 327 347 } 348 349 sub actual_local_md5sum { 350 my $filename = shift; 351 my $response = `md5sum $filename`; 352 chomp($response); 353 my ($sum, undef) = split /\s+/, $response; 354 unless(defined($sum)) { 355 warn("Failed to calculate md5sum Actually locally. $filename $host $volume"); 356 } 357 return($sum); 358 } -
trunk/tools/stsci_disks/p2_check.pl
r38475 r38682 327 327 log_print("STOP $stage $stage_id $path_base"); 328 328 } 329 329 330 close(MANIFEST); 330 331 log_print("END $stage $stage_id ${manifest_dir}/${stage}.${stage_id}.MANIFEST"); 331 332 332 333 sub my_die { … … 353 354 my ($vol_id, $vol_host, $vol_path, $xattr, $forbidden_cabinet); 354 355 my $max_used_space = 0.98; 355 my $topfew_count = 15;356 my $topfew_count = 25; 356 357 eval { 357 358 my $rows; -
trunk/tools/stsci_disks/p3_permcheck.pl
r38680 r38682 71 71 72 72 my @volumes = (); 73 for (my $i = 4; $i <= 4; $i++) { 74 my $max = 3; 75 if ($i == 4) { $max = 2; } 73 for (my $i = 4; $i <= 5; $i++) { 74 my $max = 2; 76 75 for (my $j = 0; $j < $max; $j++) { 77 76 push @volumes, sprintf("ippb%02d.%1d",$i,$j); … … 83 82 my $command; 84 83 if ($stage eq 'raw') { 84 $command = "regtool -processedimfile -data_state full -exp_id $stage_id -dbname $dbname"; 85 } 86 elsif ($stage eq 'isp') { 87 $command = "regtool -processedimfile -data_state full -exp_id $stage_id -dbname $dbname"; 88 } 89 elsif ($stage eq 'ssp') { 85 90 $command = "regtool -processedimfile -data_state full -exp_id $stage_id -dbname $dbname"; 86 91 } … … 99 104 my @keys = (); 100 105 foreach my $stageEntry ( @{ $stageData } ) { 101 if ( $stage eq 'raw') {102 if ($stageEntry->{ignored}) { next; }103 push @keys, $stageEntry->{uri};106 if (($stage eq 'raw')||($stage eq 'ssp')||($stage eq 'isp')) { 107 if ($stageEntry->{ignored}) { next; } 108 push @keys, $stageEntry->{uri}; 104 109 } 105 110 elsif ($stage eq 'cam') { 106 push @keys, $stageEntry->{path_base} . ".smf";107 for (my $u = 0; $u < 8; $u++) {108 for (my $v = 0; $v < 8; $v++) {109 if ((($u == 0)||($u == 7))&&110 (($v == 0)||($v == 7))) { next; }111 push @keys, $stageEntry->{path_base} . ".XY${u}${v}.mk.fits";112 }113 }111 push @keys, $stageEntry->{path_base} . ".smf"; 112 for (my $u = 0; $u < 8; $u++) { 113 for (my $v = 0; $v < 8; $v++) { 114 if ((($u == 0)||($u == 7))&& 115 (($v == 0)||($v == 7))) { next; } 116 push @keys, $stageEntry->{path_base} . ".XY${u}${v}.mk.fits"; 117 } 118 } 114 119 } 115 120 } … … 120 125 my ($ipp_copies,$stsci_copies) = check_instances($key); 121 126 if ($stsci_copies != 0) { 122 for (my $i = 0; $i < $stsci_copies; $i++) {123 $neb->replicate($key,$rand_vol);124 }125 print ">> REP: $key $rand_vol\n";126 sleep(5);127 my ($ipp_copies,$stsci_copies) = check_instances($key);127 for (my $i = 0; $i < $stsci_copies; $i++) { 128 $neb->replicate($key,$rand_vol); 129 } 130 print ">> REP: $key $rand_vol\n"; 131 sleep(5); 132 my ($ipp_copies,$stsci_copies) = check_instances($key); 128 133 } 129 if ($ipp_copies == 1) {130 $neb->replicate($key,$rand_vol);131 print ">> REP: $key $rand_vol\n";132 sleep(5);133 my ($ipp_copies,$stsci_copies) = check_instances($key);134 }135 if ($ipp_copies >= 2) {136 $good ++;134 # if ($ipp_copies == 1) { 135 # $neb->replicate($key,$rand_vol); 136 # print ">> REP: $key $rand_vol\n"; 137 # sleep(5); 138 # my ($ipp_copies,$stsci_copies) = check_instances($key); 139 # } 140 if ($ipp_copies >= 1) { 141 $good ++; 137 142 } 138 143 else { 139 print ">> $ipp_copies $stsci_copies\n";140 push @issues, $key;144 print ">> $ipp_copies $stsci_copies\n"; 145 push @issues, $key; 141 146 } 142 147 print "$key $good $#issues\n"; … … 146 151 if ($#issues != -1) { 147 152 foreach my $key (@issues) { 148 my ($ipp_copies,$stsci_copies) = check_instances($key);149 if ($ipp_copies < 2) {150 print "CHECK: $key\n";151 $bad++;152 }153 my ($ipp_copies,$stsci_copies) = check_instances($key); 154 if ($ipp_copies < 2) { 155 print "CHECK: $key\n"; 156 $bad++; 157 } 153 158 } 154 159 } … … 163 168 my $ipp_copies = 0; 164 169 my $stsci_copies = 0; 165 foreach my $uri (@{ $uris }) { 166 if ($uri =~ /file:...data.ipp/) {167 $ipp_copies++;168 }169 if ($uri =~ /file:...data.stsci/) {170 $stsci_copies++;171 }170 foreach my $uri (@{ $uris }) { 171 if ($uri =~ /file:...data.ipp/) { 172 $ipp_copies++; 173 } 174 if ($uri =~ /file:...data.stsci/) { 175 $stsci_copies++; 176 } 172 177 } 173 178 return($ipp_copies,$stsci_copies);
Note:
See TracChangeset
for help on using the changeset viewer.
