Ignore:
Timestamp:
08/26/09 12:15:10 (15 years ago)
Author:
ramonb
Message:

job_monarch/templates/header.tpl:

job_monarch/image.php:

  • cache XML data during jobmond's polling interval

job_monarch/jobstore.php:

  • cache XML data during jobmond's polling interval
  • set host link

job_monarch/js/monarch.js:

  • small changes to nodes popup window
File:
1 edited

Legend:

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

    r582 r646  
    3333}
    3434
    35 function checkSessionData()
    36 {
    37         global $_SESSION;
    38 
    39         session_start();
    40 
    41         if( isset( $_SESSION['data'] ) )
    42         {
    43                 $myxml_data     = &$_SESSION['data'];
    44         }
    45         else
    46         {
    47                 $myxml_data     = 0;
    48         }
    49 
    50         if( !$myxml_data ) {
    51                 $ds             = new DataSource();
    52                 $myxml_data     = $ds->getData();
    53 
    54         }
    55         return $myxml_data;
    56 }
    57 
     35function 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
     46global $session_active, $_SESSION, $myxml_data;
     47
     48function 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
     74function 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
     109checkSession();
     110$myxml_data     = &$_SESSION['data'];
     111session_write_close();
    58112
    59113$httpvars       = new HTTPVariables( $HTTP_GET_VARS, $_GET );
     
    70124if( isset($query) && ($query!='')) $filter['query']=$query;
    71125
    72 function drawHostImage() {
    73 
     126$data_gatherer  = new DataGatherer( $clustername );
     127$data_gatherer->parseXML( &$myxml_data );
     128
     129function drawHostImage()
     130{
    74131        global $clustername, $hostname, $data_gatherer;
    75132
    76         $ds             = new DataSource();
    77         $myxml_data     = $ds->getData();
    78 
    79         $data_gatherer  = new DataGatherer( $clustername );
    80 
    81         $data_gatherer->parseXML( $myxml_data );
    82 
    83133        if( $data_gatherer->isJobmonRunning() )
    84134        {
     
    93143}
    94144
    95 function drawSmallClusterImage() {
    96 
    97         global $clustername, $data_gatherer;
    98 
    99         $ds             = new DataSource();
    100         $myxml_data     = $ds->getData();
    101 
    102         $data_gatherer  = new DataGatherer( $clustername );
    103 
    104         $data_gatherer->parseXML( $myxml_data );
     145function drawSmallClusterImage()
     146{
     147        global $clustername, $data_gatherer, $myxml_data;
    105148
    106149        if( $data_gatherer->isJobmonRunning() )
     
    117160}
    118161
    119 function drawBigClusterImage() {
    120 
    121         global $filter, $clustername;
    122 
    123         $myxml_data     = checkSessionData();
     162function drawBigClusterImage()
     163{
     164        global $filter, $clustername, $myxml_data;
    124165
    125166        $ic = new ClusterImage( $myxml_data, $clustername );
     
    136177}
    137178
    138 switch( $view ) {
    139 
     179switch( $view )
     180{
    140181        case "small-clusterimage":
    141182
Note: See TracChangeset for help on using the changeset viewer.