- Timestamp:
- 06/02/05 10:43:09 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/web/addons/toga/overview.php
r122 r123 183 183 $emptynodes = 0; 184 184 185 $job_weight = array(); 186 185 187 foreach( $nodes as $node ) { 186 188 … … 189 191 if( count( $myjobs ) == 0 ) 190 192 $emptynodes++; 191 else 192 $nodes_jobs = $nodes_jobs + count( $myjobs ); 193 } 193 } 194 $used_nodes = $nr_nodes - $emptynodes; 194 195 195 196 $empty_percentage = ($emptynodes / $nr_nodes) * 100; … … 200 201 $pie_args .= "&free=$empty_percentage,$color"; 201 202 202 foreach( $jobs as $jobid => $jobattrs ) { 203 204 $qname = $jobattrs[queue]; 205 206 if( !array_search( $qname, $queues ) ) { 203 foreach( $nodes as $node ) { 204 205 $node_jobs = $node->getJobs(); 206 $nr_node_jobs = count( $node_jobs ); 207 $myhost = $node->getHostname(); 208 209 foreach( $node_jobs as $myjob ) { 210 211 // Determine the weight of this job on the node it is running 212 // - what percentage of the node is in use by this job 213 // 214 $job_weight[$myjob] = ( 100 / count( $node_jobs ) ) / 100; 215 $qname = $jobs[$myjob][queue]; 207 216 208 217 if( !isset( $queues[$qname] ) ) 209 $queues[$qname] = array();210 211 $queues[$qname][] = $jobid;218 $queues[$qname] = $job_weight[$myjob]; 219 else 220 $queues[$qname] = $queues[$qname] + $job_weight[$myjob]; 212 221 } 213 222 } 214 223 215 224 $qcolors = array(); 216 foreach( $queues as $queue => $ myjobs) {217 218 $ qjobs = count ( $myjobs );219 $percentage = ( $qjobs / $nr_jobs ) * $job_percentage;225 foreach( $queues as $queue => $totalweight) { 226 227 $percentage = ( $totalweight / $used_nodes ) * $job_percentage; 228 220 229 $color = randomColor( $qcolors ); 221 230 $qcolors[] = $color;
Note: See TracChangeset
for help on using the changeset viewer.