Ignore:
Timestamp:
11/12/09 17:08:03 (14 years ago)
Author:
ramonb
Message:

job_monarch/overview.php,
job_monarch/index.php:

  • old code cleanup

job_monarch/index.php,
job_monarch/image.php,
job_monarch/jobstore.php

  • rewrote session handling

job_monarch/image.php:

job_monarch/templates/header.tpl:

  • add session to clusterimage
  • (temp?) disabled pie chart

job_monarch/libtoga.php:

  • wrote new SessionHandler? class to handle all sessions
  • DataSource? now uses interactive port so can retrieve only relevant XML
  • disable XML_OPTION_CASE_FOLDING to speed up xml parsing
  • use jobmond poll interval to only reload XML when useful
  • use strpos instead of strstr, should be faster xml parsing
  • dont parse XML in ClusterImage? anymore, instead supply DataGather? object


job_monarch/conf.php:

  • use interactive gmetad port now
File:
1 edited

Legend:

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

    r646 r648  
    2323 */
    2424
    25 ini_set("memory_limit","200M");
     25ini_set("memory_limit","1G");
    2626set_time_limit(0);
    2727
     
    3333}
    3434
    35 function makeSession()
    36 {
    37         $ds             = new DataSource();
    38         $myxml_data     = &$ds->getData();
    39 
    40         unset( $_SESSION['data'] );
    41 
    42         $_SESSION['data']               = &$myxml_data;
    43         $_SESSION['gather_time']        = time();
    44 }
    45 
    46 global $session_active, $_SESSION, $myxml_data;
    47 
    48 function checkSessionPollInterval( $poll_interval )
    49 {
    50         global $session_active, $_SESSION;
    51 
    52         if( ! session_active )
    53         {
    54                 return 0;
    55         }
    56 
    57         if( isset( $_SESSION['poll_interval'] ) )
    58         {
    59                 if( $poll_interval <> $_SESSION['poll_interval'] )
    60                 {
    61                         $_SESSION['poll_interval']      = $poll_interval;
    62                 }
    63         }
    64         else
    65         {
    66                 $_SESSION['poll_interval']      = $poll_interval;
    67         }
    68 
    69         session_write_close();
    70 
    71         $session_active = false;
    72 }
    73 
    74 function checkSession()
    75 {
    76         global $session_active, $_SESSION;
    77 
    78         session_start();
    79 
    80         $session_active         = true;
    81 
    82         // I got nothing; create session
    83         //
    84         if( ! isset( $_SESSION['gather_time'] ) || ! isset( $_SESSION['data'] ) )
    85         {
    86                 makeSession();
    87 
    88                 return 0;
    89         }
    90 
    91         if( isset( $_SESSION['poll_interval'] ) )
    92         {
    93                 $gather_time    = $_SESSION['gather_time'];
    94                 $poll_interval  = $_SESSION['poll_interval'];
    95 
    96                 $cur_time       = time();
    97 
    98                 // If poll_interval time elapsed since last update; recreate session
    99                 //
    100                 if( ($cur_time - $gather_time) >= $poll_interval )
    101                 {
    102                         makeSession();
    103 
    104                         return 0;
    105                 }
    106         }
    107 }
    108 
    109 checkSession();
    110 $myxml_data     = &$_SESSION['data'];
    111 session_write_close();
    112 
    11335$httpvars       = new HTTPVariables( $HTTP_GET_VARS, $_GET );
    11436$view           = $httpvars->getHttpVar( "view" );
     
    11638$query          = $httpvars->getHttpVar( "query" );
    11739$clustername    = $httpvars->getClusterName();
     40
     41global $mySession, $myData, $myXML;
     42
     43//printf( "c %s\n", $clustername );
     44
     45$mySession      = new SessionHandler( $clustername );
     46$mySession->checkSession();
     47
     48$session        = &$mySession->getSession();
     49$myXML          = $session['data'];
     50
     51$myData         = new DataGatherer( $clustername );
     52$myData->parseXML( $myXML );
     53
     54$mySession->updatePollInterval( $myData->getPollInterval() );
     55$mySession->endSession();
     56
     57//printf( "%s\n", strlen( $myXML ) );
    11858
    11959if( isset($jid) && ($jid!='')) $filter['jid']=$jid;
     
    12464if( isset($query) && ($query!='')) $filter['query']=$query;
    12565
    126 $data_gatherer  = new DataGatherer( $clustername );
    127 $data_gatherer->parseXML( &$myxml_data );
    128 
    12966function drawHostImage()
    13067{
    131         global $clustername, $hostname, $data_gatherer;
     68        global $clustername, $hostname, $myData;
    13269
    133         if( $data_gatherer->isJobmonRunning() )
     70        if( $myData->isJobmonRunning() )
    13471        {
    135                 $ic = new HostImage( $data_gatherer, $clustername, $hostname );
     72                $ic = new HostImage( $myData, $clustername, $hostname );
    13673        }
    13774        else
     
    14582function drawSmallClusterImage()
    14683{
    147         global $clustername, $data_gatherer, $myxml_data;
     84        global $clustername, $myData, $myXML;
    14885
    149         if( $data_gatherer->isJobmonRunning() )
     86        //printf( "%s\n", strlen( $myXML ) );
     87
     88        if( $myData->isJobmonRunning() )
    15089        {
    151                 $ic = new ClusterImage( $myxml_data, $clustername );
     90                //$ic = new ClusterImage( $myXML, $clustername );
     91                $ic = new ClusterImage( $myData, $clustername );
    15292                $ic->setSmall();
     93                //printf( "is running\n" );
    15394        }
    15495        else
    15596        {
    15697                $ic = new EmptyImage();
     98                //printf( "not running\n" );
    15799        }
    158100
     
    162104function drawBigClusterImage()
    163105{
    164         global $filter, $clustername, $myxml_data;
     106        global $filter, $clustername, $myXML, $myData;
    165107
    166         $ic = new ClusterImage( $myxml_data, $clustername );
     108        //$ic = new ClusterImage( $myXML, $clustername );
     109        $ic = new ClusterImage( $myData, $clustername );
    167110        $ic->setBig();
    168111
Note: See TracChangeset for help on using the changeset viewer.