IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Aug 31, 2011, 5:18:37 PM (15 years ago)
Author:
watersc1
Message:

Updates to finish migration of summarization code into nebulous outputs

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/diskspace/nebulous_wiki.pl

    r32230 r32265  
    22
    33use DateTime;
    4 $dt = DateTime->now;
     4use Getopt::Std;
     5use PS::IPP::Config;
    56
    67
    7 @files = sort (<*.size.dat>);
     8$opt{S} = 0;
     9getopts('S',\%opt);
     10
     11my $dt = DateTime->now;
     12
     13my @lt = gmtime;
     14my $dt_data = DateTime->now;
     15$dt->subtract( days => $lt[6]);
     16my $datestring = $dt->ymd;
     17
     18@files = sort ( split /\n/, `neb-ls -p neb:///ipp_diskspace/${datestring}/%neb_usage.dat`);
    819
    920foreach $f (@files) {
    1021    $volume = $f;
    11     $volume =~ s/.size.dat//;
     22    $volume =~ s/.*://;
     23    $volume =~ s/.neb_usage.dat//;
    1224    open(F,$f);
    1325    while(<F>) {
     
    3749$presep = '||';
    3850
    39 print "${presep}Volume${sep}";
    40 foreach $w (sort (keys %sizes)) {
    41     print "$w$sep";
    42 }
    43 print "\n";
    44 foreach $v (sort (keys %sum)) {
    45     print "${presep}${v}${sep}";
     51if ($opt{S} == 0) {
     52    print "${presep}Volume${sep}";
    4653    foreach $w (sort (keys %sizes)) {
    47         $val = $vol{$v}{$w} / 1024 / 1024 / 1024;
     54        print "$w$sep";
     55    }
     56    print "\n";
     57    foreach $v (sort (keys %sum)) {
     58        print "${presep}${v}${sep}";
     59        foreach $w (sort (keys %sizes)) {
     60            $val = $vol{$v}{$w} / 1024 / 1024 / 1024;
     61            printf "%.2f%s",$val,$sep;
     62        }
     63        $val = $sum{$v} / 1024 / 1024 / 1024;
     64        printf "%.2f%s",$val,$sep;
     65        print "\n";
     66    }
     67    $date = $dt->ymd;
     68    print "${presep}${date}${sep}";
     69    foreach $w (sort (keys %sizes)) {
     70        $val = $sizes{$w} / 1024 / 1024 / 1024;
    4871        printf "%.2f%s",$val,$sep;
    4972    }
    50     $val = $sum{$v} / 1024 / 1024 / 1024;
    51     printf "%.2f%s",$val,$sep;
    5273    print "\n";
    5374}
    54 $date = $dt->ymd;
    55 print "${presep}${date}${sep}";
    56 foreach $w (sort (keys %sizes)) {
    57     $val = $sizes{$w} / 1024 / 1024 / 1024;
    58     printf "%.2f%s",$val,$sep;
     75else {
     76    my $ipprc = PS::IPP::Config->new("GPC1");
     77    my $nebcon = $ipprc->nebulous();
     78
     79    my $outfile = "neb:///ipp_diskspace/${datestring}/summary.dat";
     80    my $out_fh;
     81    if ($ipprc->file_exists($outfile)) {
     82        my $S_file = $ipprc->file_resolve($outfile);
     83        open($out_fh,">$S_file");
     84    }
     85    else {
     86        $out_fh = $ipprc->file_create_open($outfile);
     87    }
     88    foreach $w (sort (keys %sizes)) {
     89        $val = $sizes{$w} / 1024 / 1024 / 1024;
     90        print $out_fh "$w $val\n";
     91    }
     92    close($out_fh);
    5993}
    60 print "\n";
    6194
    6295
Note: See TracChangeset for help on using the changeset viewer.