Changeset 124 for trunk/web/addons/toga/libtoga.php
- Timestamp:
- 06/02/05 15:12:32 (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/web/addons/toga/libtoga.php
r122 r124 156 156 } 157 157 158 function getCpus() { 159 $handler = $this->xmlhandler; 160 return $handler->getCpus(); 161 } 162 158 163 function getJobs() { 159 164 $handler = $this->xmlhandler; … … 176 181 $nodes = array(); 177 182 $heartbeat = array(); 183 } 184 185 function getCpus() { 186 187 $cpus = 0; 188 189 foreach( $this->jobs as $jobid=>$jobattrs ) { 190 191 $nodes = count( $jobattrs[nodes] ); 192 $ppn = (int) $jobattrs[ppn] ? $jobattrs[ppn] : 1; 193 $mycpus = $nodes * $ppn; 194 195 $cpus = $cpus + $mycpus; 196 } 178 197 } 179 198 … … 485 504 486 505 var $dataget, $image, $clustername; 487 var $filtername, $filter value;506 var $filtername, $filters; 488 507 489 508 function ClusterImage( $clustername ) { … … 491 510 $this->dataget = new DataGatherer(); 492 511 $this->clustername = $clustername; 493 $this->filtername = null; 494 $this->filtervalue = null; 512 $this->filters = array(); 495 513 } 496 514 497 515 function setFilter( $filtername, $filtervalue ) { 498 516 517 //printf("filter %s = %s\n", $filtername, $filtervalue ); 499 518 //printf( "filter set to %s = %s\n", $filtername, $filtervalue ); 500 $this->filter name = $filtername;501 $this->filtervalue = $filtervalue;519 $this->filters[$filtername] = $filtervalue; 520 //print_r($this->filters); 502 521 } 503 522 … … 508 527 foreach( $nodes as $node ) { 509 528 510 $mynjobs = $node->getJobs();511 529 $hostname = $node->getHostname(); 512 530 513 if( $this->filtername ) { 514 foreach( $mynjobs as $myjob ) 515 516 if( $this->filtername == 'jobid' && $node->hasJob( $this->filtervalue) ) 517 $filtered_nodes[] = $hostname; 518 else if( $jobs[$myjob][$this->filtername] == $this->filtervalue && !in_array( $hostname, $filtered_nodes ) ) 519 $filtered_nodes[] = $hostname; 520 } else 531 $addhost = 1; 532 533 if( count( $this->filters ) > 0 ) { 534 535 $mynjobs = $node->getJobs(); 536 537 if( count( $mynjobs ) > 0 ) { 538 539 foreach( $mynjobs as $myjob ) { 540 541 foreach( $this->filters as $filtername => $filtervalue ) { 542 543 //printf("filter bla %s = %s\n", $filtername,$filtervalue ); 544 545 if( $filtername!=null && $filtername!='' ) { 546 547 if( $filtername == 'jobid' && !$node->hasJob( $filtervalue) ) { 548 $addhost = 0; 549 //printf("host %s has no job %s\n", $hostname, $filtervalue); 550 } else if( $filtername != 'jobid' ) { 551 //printf("myjob is %s\n", $myjob ); 552 if( $jobs[$myjob][$filtername] != $filtervalue ) { 553 //printf("host %s has no job with %s=%s\n", $hostname, $filtername, $filtervalue); 554 $addhost = 0; 555 } 556 } 557 } 558 } 559 } 560 } else 561 $addhost = 0; 562 } 563 564 if( $addhost ) 521 565 $filtered_nodes[] = $hostname; 522 566 } … … 526 570 527 571 function draw() { 572 573 //printf("stopt met uitvoer"); 574 //return; 528 575 529 576 global $SMALL_CLUSTERIMAGE_MAXWIDTH, $SMALL_CLUSTERIMAGE_NODEWIDTH;
Note: See TracChangeset
for help on using the changeset viewer.