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/jobstore.php

    r637 r646  
    5757include_once "./libtoga.php";
    5858
    59 $ds             = new DataSource();
    60 $myxml_data     = &$ds->getData();
    61 
    62 session_start();
    63 unset( $_SESSION['data'] );
    64 $_SESSION['data']       = &$myxml_data;
     59function makeSession()
     60{
     61        $ds             = new DataSource();
     62        $myxml_data     = &$ds->getData();
     63
     64        unset( $_SESSION['data'] );
     65
     66        $_SESSION['data']               = &$myxml_data;
     67        $_SESSION['gather_time']        = time();
     68}
     69
     70global $session_active, $_SESSION;
     71
     72function checkSessionPollInterval( $poll_interval )
     73{
     74        global $session_active, $_SESSION;
     75
     76        if( ! session_active )
     77        {
     78                return 0;
     79        }
     80
     81        if( isset( $_SESSION['poll_interval'] ) )
     82        {
     83                if( $poll_interval <> $_SESSION['poll_interval'] )
     84                {
     85                        $_SESSION['poll_interval']      = $poll_interval;
     86                }
     87        }
     88        else
     89        {
     90                $_SESSION['poll_interval']      = $poll_interval;
     91        }       
     92
     93        session_write_close();
     94
     95        $session_active = false;
     96}
     97
     98function checkSession()
     99{
     100        global $session_active, $_SESSION;
     101
     102        session_start();
     103
     104        $session_active         = true;
     105
     106        // I got nothing; create session
     107        //
     108        if( ! isset( $_SESSION['gather_time'] ) || ! isset( $_SESSION['data'] ) )
     109        {
     110                makeSession();
     111
     112                return 0;       
     113        }
     114
     115        if( isset( $_SESSION['poll_interval'] ) )
     116        {
     117                $gather_time    = $_SESSION['gather_time'];
     118                $poll_interval  = $_SESSION['poll_interval'];
     119
     120                $cur_time       = time();
     121
     122                // If poll_interval time elapsed since last update; recreate session
     123                //
     124                if( ($cur_time - $gather_time) >= $poll_interval )
     125                {
     126                        makeSession();
     127
     128                        return 0;       
     129                }
     130        }
     131}
     132
     133checkSession();
    65134
    66135global $jobs, $metrics;
    67136
    68137$data_gatherer  = new DataGatherer( $clustername );
    69 $data_gatherer->parseXML( &$myxml_data );
     138$data_gatherer->parseXML( &$_SESSION['data'] );
    70139
    71140$heartbeat      = &$data_gatherer->getHeartbeat();
     
    495564                $reported       = (int) $jobs[$jid]['reported'];
    496565
     566                $poll_interval  = (int) $jobs[$jid]['poll_interval'];
     567
     568                checkSessionPollInterval( $poll_interval );
     569
    497570                $time           = time();
    498571
     
    501574                $job_runtime    = $time - intval( $jobs[$jid]['start_timestamp'] );
    502575                //$job_runtime  = date( 'u' ) - intval( $jobs[$jid]['start_timestamp'] );
    503                 //$job_window   = intval( $job_runtime ) * 1.2;
     576                $job_window     = intval( $job_runtime ) * 1.2;
    504577
    505578                $jobrange       = -$job_window;
     
    508581
    509582                $nr['jid']      = $jid;
     583                $nr['nodename'] = $host;
    510584
    511585                $hostar         = array( $host );
     
    523597                // maybe later to popup?
    524598                //
    525                 //$host_link      = "\"../../?c=$cluster_url&h=$host_url&r=job&jr=$jobrange&job_start=$jobstart\"";
     599                $host_link      = "../../?c=$cluster_url&h=$host_url&r=job&jr=$jobrange&job_start=$jobstart";
     600
     601                $nr['hostlink'] = $host_link;
    526602
    527603                if ( $val["TYPE"] == "timestamp" || $always_timestamp[$metricname] )
     
    608684                $jr['requested_time']   = makeTime( timeToEpoch( $jobs[$jobid]['requested_time'] ) );
    609685
     686                $poll_interval          = (int) $jobs[$jobid]['poll_interval'];
     687
     688                checkSessionPollInterval( $poll_interval );
     689
    610690                if( $jr['status'] == 'R' )
    611691                {
Note: See TracChangeset for help on using the changeset viewer.