Changeset 646
- Timestamp:
- 08/26/09 12:15:10 (15 years ago)
- Location:
- trunk/web/addons/job_monarch
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/web/addons/job_monarch/image.php
r582 r646 33 33 } 34 34 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 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(); 58 112 59 113 $httpvars = new HTTPVariables( $HTTP_GET_VARS, $_GET ); … … 70 124 if( isset($query) && ($query!='')) $filter['query']=$query; 71 125 72 function drawHostImage() { 73 126 $data_gatherer = new DataGatherer( $clustername ); 127 $data_gatherer->parseXML( &$myxml_data ); 128 129 function drawHostImage() 130 { 74 131 global $clustername, $hostname, $data_gatherer; 75 132 76 $ds = new DataSource();77 $myxml_data = $ds->getData();78 79 $data_gatherer = new DataGatherer( $clustername );80 81 $data_gatherer->parseXML( $myxml_data );82 83 133 if( $data_gatherer->isJobmonRunning() ) 84 134 { … … 93 143 } 94 144 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 ); 145 function drawSmallClusterImage() 146 { 147 global $clustername, $data_gatherer, $myxml_data; 105 148 106 149 if( $data_gatherer->isJobmonRunning() ) … … 117 160 } 118 161 119 function drawBigClusterImage() { 120 121 global $filter, $clustername; 122 123 $myxml_data = checkSessionData(); 162 function drawBigClusterImage() 163 { 164 global $filter, $clustername, $myxml_data; 124 165 125 166 $ic = new ClusterImage( $myxml_data, $clustername ); … … 136 177 } 137 178 138 switch( $view ) {139 179 switch( $view ) 180 { 140 181 case "small-clusterimage": 141 182 -
trunk/web/addons/job_monarch/jobstore.php
r637 r646 57 57 include_once "./libtoga.php"; 58 58 59 $ds = new DataSource(); 60 $myxml_data = &$ds->getData(); 61 62 session_start(); 63 unset( $_SESSION['data'] ); 64 $_SESSION['data'] = &$myxml_data; 59 function 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 70 global $session_active, $_SESSION; 71 72 function 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 98 function 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 133 checkSession(); 65 134 66 135 global $jobs, $metrics; 67 136 68 137 $data_gatherer = new DataGatherer( $clustername ); 69 $data_gatherer->parseXML( &$ myxml_data);138 $data_gatherer->parseXML( &$_SESSION['data'] ); 70 139 71 140 $heartbeat = &$data_gatherer->getHeartbeat(); … … 495 564 $reported = (int) $jobs[$jid]['reported']; 496 565 566 $poll_interval = (int) $jobs[$jid]['poll_interval']; 567 568 checkSessionPollInterval( $poll_interval ); 569 497 570 $time = time(); 498 571 … … 501 574 $job_runtime = $time - intval( $jobs[$jid]['start_timestamp'] ); 502 575 //$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; 504 577 505 578 $jobrange = -$job_window; … … 508 581 509 582 $nr['jid'] = $jid; 583 $nr['nodename'] = $host; 510 584 511 585 $hostar = array( $host ); … … 523 597 // maybe later to popup? 524 598 // 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; 526 602 527 603 if ( $val["TYPE"] == "timestamp" || $always_timestamp[$metricname] ) … … 608 684 $jr['requested_time'] = makeTime( timeToEpoch( $jobs[$jobid]['requested_time'] ) ); 609 685 686 $poll_interval = (int) $jobs[$jobid]['poll_interval']; 687 688 checkSessionPollInterval( $poll_interval ); 689 610 690 if( $jr['status'] == 'R' ) 611 691 { -
trunk/web/addons/job_monarch/js/monarch.js
r645 r646 764 764 JobsColumnModel = new Ext.grid.ColumnModel( 765 765 { 766 //CheckJobs,767 766 defaults: 768 767 { … … 773 772 columns: 774 773 [ 774 CheckJobs, 775 775 { 776 776 header: '#', … … 926 926 },[ 927 927 {name: 'jid', type: 'string', mapping: 'jid'}, 928 {name: 'ga', type: 'string', mapping: 'ga'} 928 {name: 'ga', type: 'string', mapping: 'ga'}, 929 {name: 'nodename', type: 'string', mapping: 'nodename'}, 930 {name: 'hostlink', type: 'string', mapping: 'hostlink'} 929 931 ]), 930 932 listeners: … … 976 978 '<tpl for=".">', 977 979 //'<div class="rrd-float"><a href="./graph.php?z=large&{ga}" border="0" rel="lightbox[{jid}.{[globalWindowCount]}]"><img src="./graph.php?z=small&{ga}" border="0"></a></div>', 978 '<div class="rrd-float"><img src="./graph.php?z=small&{ga}" border="0" style="cursor:pointer" onclick="nodeWindow(\' node x\', \'{ga}\');"></a></div>',980 '<div class="rrd-float"><img src="./graph.php?z=small&{ga}" border="0" style="cursor:pointer" onclick="nodeWindow(\'{nodename}\', \'{hostlink}\');"></a></div>', 979 981 '</tpl>') 980 982 }); -
trunk/web/addons/job_monarch/templates/header.tpl
r641 r646 35 35 JobProxy.on('beforeload', function(p, params) 36 36 { 37 params.c = "{cluster}"; 38 newparams = joinMyArray( params, myfilters ); 39 myparams = newparams; 40 params = newparams; 37 params['c'] = '{cluster}'; 38 params['{session_name}'] = '{session_id}'; 39 newparams = joinMyArray( params, myfilters ); 40 myparams = newparams; 41 params = newparams; 41 42 }); 42 43
Note: See TracChangeset
for help on using the changeset viewer.