IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Nov 14, 2019, 2:50:20 PM (7 years ago)
Author:
ippitc
Message:

improve loading speed

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ippMonitor/czartool/czarpoll.pl

    r40879 r41125  
    236236        $pantasks->getServerStatus($server,'gpc2', \$alive, \$running);
    237237        $czarDb->updateServerStatus($server,'gpc2', $alive, $running);
     238   }
     239}
     240
     241###########################################################################
     242#
     243# Updates pantasks server status TODO should really get info for all servers at once
     244#
     245###########################################################################
     246sub updateServerStatusLive {
     247    print "* Checking all pantasks servers\n";
     248
     249    my $servers = $pantasks->getServerList();
     250
     251    my $server = undef;
     252    my $alive = undef;
     253    my $running = undef;
     254    foreach $server (@{$servers}) {
     255        $pantasks->getServerStatus($server,'gpc1', \$alive, \$running);
     256        $czarDb->updateServerStatusLive($server,'gpc1', $alive, $running);
     257        $pantasks->getServerStatus($server,'gpc2', \$alive, \$running);
     258        $czarDb->updateServerStatusLive($server,'gpc2', $alive, $running);
    238259   }
    239260}
     
    272293    my $newDayTime = $config->getMetricsStartTime();
    273294    my $lastDayDailyTasks = "2010-01-01";
    274 
     295    my $checkneb = 1; # 1 for nebulous, 0 for localhost test
    275296    # main polling loop
    276297    while (1) {
     298
    277299        my $iterationStartTime = time();
    278 
     300 
    279301        #get the time of last czarpoll update
    280302        $polldate = $czarDb->getPollDate();
     
    287309        if($timediff > 120.) {
    288310            print "There is no recent Czarpoll iteration\n";
    289             print "*Updating database entries*\n";
     311            print "* Updating database entries*\n";
    290312            $dbupdate = 1;
    291313        } else {
    292314            print "There is a recent Czarpoll iteration already made ($timediff sec ago)\n";
    293             print "*Skipping database queries and entries*\n";
     315            print "* Skipping database queries and entries\n";
    294316            $dbupdate = 0;
    295317        }
     
    326348                #TdB20190703: The ipp113 and ipp117 instances of czarpoll use the same stage DBs in czarDB.
    327349                #Therefore, it makes no sense to run the cleanup+optimising twice
    328                 #print "* Performing database cleanup\n";
    329                 #$czarDb->cleanupDateRange($yesterday, $yesterday, $config->getCzarCleanupInterval());
    330                 #print "* Optimizing the database\n";
    331                 #$czarDb->optimize();
     350                print "* Performing database cleanup\n";
     351                $czarDb->cleanupDateRange($yesterday, $yesterday, $config->getCzarCleanupInterval());
     352                print "* Optimizing the database\n";
     353                $czarDb->optimize();
    332354                $lastDayDailyTasks = $yesterday;
    333355            }
     
    344366
    345367        # check nebulous
    346         print "* Checking Nebulous\n";
    347         if($dbupdate == 1) {$nebulous->updateClusterSpaceInfo();}
    348         $plotter0->plotStorageTimeSeries($czarDb->subtractInterval($begin, "1 WEEK") , $end);
    349         $plotter0->plotDiskUsageHistogram();
    350         $plotter0->plotDiskUsageHistogramLarge();
     368        if ($checkneb == 1) {
     369            print "* Checking Nebulous\n";
     370            if($dbupdate == 1) {$nebulous->updateClusterSpaceInfo();}
     371            $plotter0->plotStorageTimeSeries($czarDb->subtractInterval($begin, "1 WEEK") , $end);
     372            $plotter0->plotDiskUsageHistogram();
     373            $plotter0->plotDiskUsageHistogramLarge();
     374        }
     375        else {
     376            print "* Locahost, so no checking nebulous\n";
     377        }
     378
     379        # check pantasks status
    351380        if($dbupdate == 1) {updateServerStatus();}
     381        if($dbupdate == 1) {updateServerStatusLive();}
    352382
    353383        # check pantasks dates
Note: See TracChangeset for help on using the changeset viewer.