source: trunk/web/addons/job_monarch/image.php @ 648

Last change on this file since 648 was 648, checked in by ramonb, 12 years ago

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 size: 3.1 KB
Line 
1<?php
2/*
3 *
4 * This file is part of Jobmonarch
5 *
6 * Copyright (C) 2006  Ramon Bastiaans
7 *
8 * Jobmonarch is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * Jobmonarch is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
21 *
22 * SVN $Id: image.php 329 2007-04-22 13:36:26Z bastiaans $
23 */
24
25ini_set("memory_limit","1G");
26set_time_limit(0);
27
28include_once "./libtoga.php";
29
30if ( !empty( $_GET ) )
31{
32        extract( $_GET );
33}
34
35$httpvars       = new HTTPVariables( $HTTP_GET_VARS, $_GET );
36$view           = $httpvars->getHttpVar( "view" );
37$host           = $httpvars->getHttpVar( "host" );
38$query          = $httpvars->getHttpVar( "query" );
39$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 ) );
58
59if( isset($jid) && ($jid!='')) $filter['jid']=$jid;
60if( isset($state) && ($state!='')) $filter['state']=$state;
61if( isset($owner) && ($owner!='')) $filter['owner']=$owner;
62if( isset($queue) && ($queue!='')) $filter['queue']=$queue;
63if( isset($host) && ($host!='')) $filter['host']=$host;
64if( isset($query) && ($query!='')) $filter['query']=$query;
65
66function drawHostImage()
67{
68        global $clustername, $hostname, $myData;
69
70        if( $myData->isJobmonRunning() )
71        {
72                $ic = new HostImage( $myData, $clustername, $hostname );
73        }
74        else
75        {
76                $ic = new EmptyImage();
77        }
78
79        $ic->draw();
80}
81
82function drawSmallClusterImage() 
83{
84        global $clustername, $myData, $myXML;
85
86        //printf( "%s\n", strlen( $myXML ) );
87
88        if( $myData->isJobmonRunning() )
89        {
90                //$ic = new ClusterImage( $myXML, $clustername );
91                $ic = new ClusterImage( $myData, $clustername );
92                $ic->setSmall();
93                //printf( "is running\n" );
94        }
95        else
96        {
97                $ic = new EmptyImage();
98                //printf( "not running\n" );
99        }
100
101        $ic->draw();
102}
103
104function drawBigClusterImage()
105{
106        global $filter, $clustername, $myXML, $myData;
107
108        //$ic = new ClusterImage( $myXML, $clustername );
109        $ic = new ClusterImage( $myData, $clustername );
110        $ic->setBig();
111
112        if( isset( $filter ) )
113        {
114                foreach( $filter as $filtername=>$filtervalue )
115                {
116                        $ic->setFilter( $filtername, $filtervalue );
117                }
118        }
119        $ic->draw();
120}
121
122switch( $view ) 
123{
124        case "small-clusterimage":
125
126                drawSmallClusterImage();
127               
128                break;
129
130        case "big-clusterimage":
131
132                drawBigClusterImage();
133       
134                break;
135
136        case "hostimage":
137
138                drawHostImage();
139       
140                break;
141
142        default:
143
144                break;
145}
146
147?>
Note: See TracBrowser for help on using the repository browser.