IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 32602


Ignore:
Timestamp:
Nov 2, 2011, 2:46:41 PM (15 years ago)
Author:
watersc1
Message:

Add date options as needed. Handle non-nebulous space in a way that allows it to be accounted better.

Location:
trunk/tools/diskspace
Files:
4 edited

Legend:

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

    r32265 r32602  
    55use PS::IPP::Config;
    66
    7 getopts('N',\%opt);
     7getopts('ND:',\%opt);
    88
    99my $ipprc = PS::IPP::Config->new("GPC1");
    1010my $nebcon = $ipprc->nebulous();
    1111
    12 my @lt = gmtime;
    13 my $dt = DateTime->now;
    14 $dt->subtract( days => $lt[6] );
    15 my $datestring = $dt->ymd;
     12
     13my $datestring;
     14if (exists($opt{D})) {
     15    $datestring = $opt{D};
     16}
     17else {
     18    my @lt = gmtime;
     19    my $dt = DateTime->now;
     20    $dt->subtract( days => $lt[6] );
     21    $datestring = $dt->ymd;
     22}
    1623
    1724my $summary_file = "neb:///ipp_diskspace/${datestring}/summary.dat";
     
    94101
    95102if (exists($opt{N})) {
    96     my $dt = DateTime->now;
     103#     my $dt = DateTime->now;
    97104
    98     my @lt = gmtime;
    99     my $dt_data = DateTime->now;
    100     $dt->subtract( days => $lt[6]);
    101     my $datestring = $dt->ymd;
     105#     my @lt = gmtime;
     106#     my $dt_data = DateTime->now;
     107#     $dt->subtract( days => $lt[6]);
     108#     my $datestring = $dt->ymd;
     109
    102110    my $ipprc = PS::IPP::Config->new("GPC1");
    103111    my $nebcon = $ipprc->nebulous();
     
    123131        if ($stage eq 'RAW') {
    124132            $label = "PERMANENT";
     133        }
     134        elsif ($stage eq 'EXTERNAL') {
     135            $label = 'EXTERNAL';
    125136        }
    126137        else {
  • trunk/tools/diskspace/nebulous_data.pl

    r32265 r32602  
    6161my $neb_dir = "/data/${neb}/nebulous/";
    6262
     63my $total_volume = 0;
     64my $used_volume  = 0;
     65open(DF,"df -B 1 /data/${neb}/ |") || die "Cannot run df\n";
     66while(<DF>) {
     67    chomp;
     68    if ($_ =~ /${neb}/) {
     69        $used_volume = (split /\s+/, $_)[2];
     70    }
     71}
     72close(DF);
     73
    6374open(FIND,"find $neb_dir -type f -printf \"%f %s\n\" |") || die "Cannot run find.\n";
     75
     76
    6477while (<FIND>) {
    6578    chomp;
     
    88101    $count{$stage}{$product} += 1;
    89102    $volume{$stage}{$product} += $size;
     103    $total_volume += $size;
    90104}
    91105close(FIND);
     106
    92107
    93108
     
    98113    }
    99114}
     115my $external_volume = $used_volume - $total_volume;
     116print $out_fh "EXTERNAL UNKNOWN 1 $external_volume\n";
    100117
    101118close($out_fh);
  • trunk/tools/diskspace/run_counter.pl

    r32267 r32602  
    7777    }
    7878}
     79print $out_fh "EXTERNAL any 1\n";
    7980close($out_fh);
    8081
  • trunk/tools/diskspace/sizes_from_counts.pl

    r32230 r32602  
    11#! /usr/local/bin/perl -w
     2
     3
     4use Getopt::Std;
     5use DateTime;
     6use PS::IPP::Config;
     7
     8getopts('D:',\%opt);
     9
    210my $count_list = shift;
     11my $ipprc = PS::IPP::Config->new("GPC1");
     12my $nebcon = $ipprc->nebulous();
     13
     14
     15if (exists($opt{D})) {
     16    my $datestring = $opt{D};
     17    my $usage_data = "neb:///ipp_diskspace/${datestring}/usage_report.dat";
     18    my $real_file  = $ipprc->file_resolve($usage_data);
     19    open(DATA,$real_file) || die "Cannot find usage_report.dat\n";
     20}
    321
    422while(<DATA>) {
    523    chomp;
     24    if ($_ =~ /^\s+/) {
     25        next;
     26    }
    627    ($stage,$state,$label,undef,$rate,$count) = split /\s+/;
    728    $data{$stage}{$state}{L} = $label;
Note: See TracChangeset for help on using the changeset viewer.