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/run_counter.pl

    r32230 r32265  
    1 #! /usr/local/bin/perl -w
     1#! /usr/bin/env perl
     2use warnings;
    23
     4use DateTime;
     5use Sys::Hostname;
     6use PS::IPP::Config;
    37use DBI;
    4 use Getopt::Std;
    58
    6 getopts('I',\%opt);
    79# Set up the database
    810use constant DB_SOCKET => '/var/run/mysqld/mysqld.sock';
     
    4143$im_query = 'select data_state,count(data_state) AS N from TABLETABLE GROUP BY data_state';
    4244
    43 if (exists($opt{I})) {
    44     foreach $k (keys %im_stages) {
    45         $stages{$k} = $im_stages{$k};
    46     }
     45foreach $k (keys %im_stages) {
     46    $stages{$k} = $im_stages{$k};
    4747}
     48
     49my $ipprc = PS::IPP::Config->new("GPC1");
     50my $nebcon = $ipprc->nebulous();
     51
     52my @lt = gmtime;
     53$dt = DateTime->now;
     54$dt->subtract( days => $lt[6]);
     55my $datestring = $dt->ymd;
     56my $outfile = "neb:///ipp_diskspace/${datestring}/run_im_counts.dat";
     57my $out_fh = $ipprc->file_create_open($outfile);
    4858
    4959foreach $s (keys %stages) {
    5060    my $query = $base_query;
    51     if (exists($opt{I}) && exists($im_stages{$s})) {
     61    if (exists($im_stages{$s})) {
    5262        $query = $im_query;
    5363    }
     
    5767    foreach $rr (@{ $dr }) {
    5868        my ($state,$count) = @{ $rr };
    59         print "$s $state $count\n";
     69        print $out_fh "$s $state $count\n";
    6070    }
    6171}
    62            
     72close($out_fh);
     73
Note: See TracChangeset for help on using the changeset viewer.