source: trunk/web2/addons/job_monarch/image.php @ 555

Last change on this file since 555 was 555, checked in by ramonb, 16 years ago

job_monarch/js/jobgrid.js:

job_monarch/templates/header.tpl:

  • removed some positioning stuff

job_monarch/index.php,
job_monarch/image.php:

  • more memory limits
File size: 3.6 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","200M");
26set_time_limit(0);
27
28include_once "./libtoga.php";
29
30if ( !empty( $_GET ) ) {
31        extract( $_GET );
32}
33
34function checkSessionData() {
35
36        global $_SESSION;
37
38        session_start();
39
40        if( isset( $_SESSION["data"] ) ) {
41                $myxml_data     = &$_SESSION["data"];
42        } else {
43                $myxml_data     = 0;
44        }
45
46        if( !$myxml_data ) {
47                $ds             = new DataSource();
48                $myxml_data     = $ds->getData();
49
50                //print_f( "%s\n", $myxml_data );
51        }
52        return $myxml_data;
53}
54
55
56$httpvars = new HTTPVariables( $HTTP_GET_VARS, $_GET );
57$view = $httpvars->getHttpVar( "view" );
58$host = $httpvars->getHttpVar( "host" );
59$clustername = $httpvars->getClusterName();
60
61if( isset($jid) && ($jid!='')) $filter[jid]=$jid;
62if( isset($state) && ($state!='')) $filter[state]=$state;
63if( isset($owner) && ($owner!='')) $filter[owner]=$owner;
64if( isset($queue) && ($queue!='')) $filter[queue]=$queue;
65if( isset($host) && ($host!='')) $filter[host]=$host;
66//printf("host = %s\n", $filter[host] );
67
68function drawHostImage() {
69
70        global $clustername, $hostname, $data_gatherer;
71
72        $ds             = new DataSource();
73        $myxml_data     = $ds->getData();
74
75        $data_gatherer  = new DataGatherer( $clustername );
76
77        $data_gatherer->parseXML( $myxml_data );
78
79        if( $data_gatherer->isJobmonRunning() )
80                $ic = new HostImage( $data_gatherer, $clustername, $hostname );
81        else
82                $ic = new EmptyImage();
83
84        $ic->draw();
85}
86
87function drawSmallClusterImage() {
88
89        global $clustername, $data_gatherer;
90
91        $ds             = new DataSource();
92        $myxml_data     = $ds->getData();
93
94        $data_gatherer  = new DataGatherer( $clustername );
95
96        $data_gatherer->parseXML( $myxml_data );
97
98        if( $data_gatherer->isJobmonRunning() ) {
99                $ic = new ClusterImage( $myxml_data, $clustername );
100                $ic->setSmall();
101        } else {
102                $ic = new EmptyImage();
103        }
104
105        $ic->draw();
106}
107
108function drawBigClusterImage() {
109
110        global $filter, $clustername;
111
112        $myxml_data     = checkSessionData();
113
114        $ic = new ClusterImage( $myxml_data, $clustername );
115        $ic->setBig();
116
117        if( isset( $filter ) ) {
118                foreach( $filter as $filtername=>$filtervalue ) {
119                        //printf("filter %s,%s\n", $filtername, $filtervalue);
120                        switch( $filtername ) {
121
122                                case "jid":
123                                        $ic->setFilter( 'jobid', $filtervalue );
124                                        break;
125                                case "owner":
126                                        $ic->setFilter( 'owner', $filtervalue);
127                                        break;
128                                case "queue":
129                                        $ic->setFilter( 'queue', $filtervalue);
130                                        break;
131                                case "state":
132                                        $ic->setFilter( 'status', $filtervalue);
133                                        break;
134                                case "host":
135                                        $ic->setFilter( 'host', $filtervalue);
136                                        break;
137                                default:
138                                        break;
139                        }
140                }
141        }
142        $ic->draw();
143}
144
145switch( $view ) {
146
147        case "small-clusterimage":
148
149                drawSmallClusterImage();
150               
151                break;
152
153        case "big-clusterimage":
154
155                drawBigClusterImage();
156       
157                break;
158
159        case "hostimage":
160
161                drawHostImage();
162       
163                break;
164
165        default:
166
167                break;
168}
169
170?>
Note: See TracBrowser for help on using the repository browser.