Ignore:
Timestamp:
04/16/07 17:32:56 (17 years ago)
Author:
bastiaans
Message:

web/addons/job_monarch/conf.php:

  • added: big clusterimage values
  • changed: small clusterimage values

web/addons/job_monarch/image.php:

web/addons/job_monarch/libtoga.php:

Location:
trunk/web/addons/job_monarch
Files:
3 edited

Legend:

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

    r299 r305  
    3535// The size of a single node in the small clusterimage
    3636//
    37 $SMALL_CLUSTERIMAGE_NODEWIDTH = 11;
     37$SMALL_CLUSTERIMAGE_NODEWIDTH = 7;
     38
     39// Max size of small clusterimage
     40// (250 pixels is same width as Ganglia's pie chart)
     41//
     42$BIG_CLUSTERIMAGE_MAXWIDTH = 250;
     43
     44// The size of a single node in the small clusterimage
     45//
     46$BIG_CLUSTERIMAGE_NODEWIDTH = 11;
     47
     48// Max size of small host image
     49//
     50$SMALL_HOSTIMAGE_MAXWIDTH = 450;
    3851
    3952// How to mark nodes with a job in clusterimage
  • trunk/web/addons/job_monarch/image.php

    r303 r305  
    6161        $data_gatherer->parseXML();
    6262
    63         if( $data_gatherer->isJobmonRunning() )
     63        if( $data_gatherer->isJobmonRunning() ) {
    6464                $ic = new ClusterImage( $clustername );
    65         else
     65                $ic->setSmall();
     66        } else {
    6667                $ic = new EmptyImage();
     68        }
    6769
    6870        $ic->draw();
     
    7476
    7577        $ic = new ClusterImage( $clustername );
     78        $ic->setBig();
    7679
    7780        if( isset( $filter ) ) {
  • trunk/web/addons/job_monarch/libtoga.php

    r303 r305  
    769769        function NodeImage( $hostname ) {
    770770
     771                global $SMALL_CLUSTERIMAGE_NODEWIDTH;
     772
    771773                $this->jobs = array();
    772774                //$this->image = $image;
     
    777779                $this->cpus = $this->determineCpus();
    778780                $this->showinfo = 1;
     781                $this->size = $SMALL_CLUSTERIMAGE_NODEWIDTH;
    779782        }
    780783
     
    844847        }
    845848
     849        function drawSmall() {
     850
     851                global $SMALL_CLUSTERIMAGE_NODEWIDTH;
     852
     853                $this->size     = $SMALL_CLUSTERIMAGE_NODEWIDTH;
     854
     855                $this->draw();
     856        }
     857
     858        function drawBig() {
     859
     860                global $BIG_CLUSTERIMAGE_NODEWIDTH;
     861
     862                $this->size     = $BIG_CLUSTERIMAGE_NODEWIDTH;
     863
     864                $this->draw();
     865        }
     866
    846867        function draw() {
    847868
    848                 $this->drawSmall();
    849         }
    850 
    851         function drawBig() {
    852 
    853         }
    854 
    855         function drawSmall() {
    856 
    857                 global $SMALL_CLUSTERIMAGE_NODEWIDTH;
    858869                global $JOB_NODE_MARKING;
    859870
    860871                $black_color = imageColorAllocate( $this->image, 0, 0, 0 );
    861                 $size = $SMALL_CLUSTERIMAGE_NODEWIDTH;
     872                $size = $this->size;
    862873
    863874                imageFilledRectangle( $this->image, $this->x, $this->y, $this->x+($size), $this->y+($size), $black_color );
     
    920931        function ClusterImage( $clustername ) {
    921932
    922                 //printf( "image cluster = %s\n", $clustername );
    923                 $this->dataget = new DataGatherer( $clustername );
    924                 $this->clustername = $clustername;
    925                 $this->filters = array();
     933                $this->dataget          = new DataGatherer( $clustername );
     934                $this->clustername      = $clustername;
     935                $this->filters          = array();
     936                $this->size             = 's';
     937        }
     938
     939        function setSmall() {
     940                $this->size     = 's';
     941        }
     942
     943        function setBig() {
     944                $this->size     = 'b';
     945        }
     946
     947        function isSmall() {
     948                return ($this->size == 's');
     949        }
     950
     951        function isBig() {
     952                return ($this->size == 'b');
    926953        }
    927954
    928955        function setFilter( $filtername, $filtervalue ) {
    929956
    930                 //printf("filter %s = %s\n", $filtername, $filtervalue );
    931                 //printf( "filter set to %s = %s\n", $filtername, $filtervalue );
    932957                $this->filters[$filtername] = $filtervalue;
    933                 //print_r($this->filters);
    934958        }
    935959
     
    953977
    954978                                                foreach( $this->filters as $filtername => $filtervalue ) {
    955 
    956                                                         //printf("filter bla %s = %s\n", $filtername,$filtervalue );
    957979
    958980                                                        if( $filtername!=null && $filtername!='' ) {
     
    960982                                                                if( $filtername == 'jobid' && !$node->hasJob( $filtervalue) ) {
    961983                                                                        $addhost = 0;
    962                                                                         //printf("host %s has no job %s\n", $hostname, $filtervalue);
    963984                                                                } else if( $filtername != 'jobid' ) {
    964                                                                         //printf("myjob is %s\n", $myjob );
    965985                                                                        if( $jobs[$myjob][$filtername] != $filtervalue ) {
    966                                                                                 //printf("host %s has no job with %s=%s\n", $hostname, $filtername, $filtervalue);
    967986                                                                                $addhost = 0;
    968987                                                                        }
     
    9841003        function draw() {
    9851004
    986                 //printf("stopt met uitvoer");
    987                 //return;
    988 
    9891005                global $SMALL_CLUSTERIMAGE_MAXWIDTH, $SMALL_CLUSTERIMAGE_NODEWIDTH;
     1006                global $BIG_CLUSTERIMAGE_MAXWIDTH, $BIG_CLUSTERIMAGE_NODEWIDTH;
    9901007       
    9911008                $mydatag = $this->dataget;
    9921009                $mydatag->parseXML();
    9931010
    994                 //$max_width = 250;
    995                 //$node_width = 11;
    996 
    997                 $max_width = $SMALL_CLUSTERIMAGE_MAXWIDTH;
    998                 $node_width = $SMALL_CLUSTERIMAGE_NODEWIDTH;
    999 
    1000                 //printf( "cmaxw %s nmaxw %s", $SMALL_CLUSTERIMAGE_MAXWIDTH, $SMALL_CLUSTERIMAGE_NODEWIDTH );
     1011                if( $this->isSmall() ) {
     1012                        $max_width = $SMALL_CLUSTERIMAGE_MAXWIDTH;
     1013                        $node_width = $SMALL_CLUSTERIMAGE_NODEWIDTH;
     1014                } else if( $this->isBig() ) {
     1015                        $max_width = $BIG_CLUSTERIMAGE_MAXWIDTH;
     1016                        $node_width = $BIG_CLUSTERIMAGE_NODEWIDTH;
     1017                }
    10011018
    10021019                $nodes = $mydatag->getNodes();
     
    10561073                                                $nodes[$host]->setShowinfo( 0 );
    10571074
    1058                                         $nodes[$host]->draw();
     1075                                        if( $this->isSmall() )
     1076                                                $nodes[$host]->drawSmall();
     1077                                        else if( $this->isBig() )
     1078                                                $nodes[$host]->drawBig();
    10591079                                }
    10601080                        }
Note: See TracChangeset for help on using the changeset viewer.