Ignore:
Timestamp:
03/08/08 21:32:55 (16 years ago)
Author:
bastiaans
Message:

overview.php:

  • changed na_nodes/cpus counting to use nodes objects: shorter now
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/web/addons/job_monarch/overview.php

    r512 r516  
    581581        $rjqj_host              = null;
    582582
    583         $nodes_down             = null;
    584         $nodes_offline          = null;
    585 
    586         $replacestr = array();
    587         $replacestr[] = "'";
    588         $replacestr[] = " ";
    589        
     583        $na_nodes               = 0;
     584        $na_cpus                = 0;
     585
    590586        foreach( $metrics as $bhost => $bmetric )
    591587        {
     
    596592                                $rjqj_host      = $bhost;
    597593                        }
    598                         if( ( $mname == 'MONARCH-DOWN' ) )
    599                         {
    600                                 $nodes_down = str_replace($replacestr,NULL,split(',',substr($mval['VAL'],1,-1)));
    601                         }
    602                         if( ( $mname == 'MONARCH-OFFLINE' ) )
    603                         {
    604                                 $nodes_offline = str_replace($replacestr,NULL,split(',',substr($mval['VAL'],1,-1)));
    605                         }
    606594                }
    607595        }
    608596
    609         $nodes_counted          = array();
    610 
    611         if($nodes_down != NULL || $nodes_offline!=NULL )
    612         {
    613                 foreach( $metrics as $bh => $bm )
     597        foreach( $gnodes as $ghost => $gnode )
     598        {
     599                if( $gnode->isDown() || $gnode->isOffline() )
    614600                {
    615                         if (in_array($bh,$nodes_offline) && $gnodes[$bh])
    616                         {
    617                                 $nodes_counted[] = $bh;
    618                                 if(! $gnodes[$bh]->getJobs())
    619                                 {
    620                                         $na_cpus += ($bm['cpu_num'][VAL]);
    621                                         $na_nodes += 1;
    622                                 }
    623                         }
    624                         if (in_array($bh,$nodes_down) && !in_array($bh,$nodes_counted) && $gnodes[$bh])
    625                         {
    626                                 $nodes_counted[] = $bh;
    627                                 if(! $gnodes[$bh]->getJobs())
    628                                 {
    629                                         $na_cpus += ($bm['cpu_num'][VAL]);
    630                                         $na_nodes += 1;
    631                                 }
    632                         }                               
     601                        $na_nodes       += 1;
     602                        $na_cpus        += $metrics[$ghost]['cpu_num']['VAL'];
    633603                }
    634604        }
    635                
     605
    636606        // Running / queued amount jobs graph
    637607        //
Note: See TracChangeset for help on using the changeset viewer.