Changeset 648 for trunk/web/addons/job_monarch/jobstore.php
- Timestamp:
- 11/12/09 17:08:03 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/web/addons/job_monarch/jobstore.php
r646 r648 1 1 <?php 2 2 3 ini_set("memory_limit"," 200M");3 ini_set("memory_limit","1G"); 4 4 set_time_limit(0); 5 6 //ini_set("xdebug.profiler_output_dir","/tmp"); 7 //ini_set("xdebug.profiler_output_name","timestamp"); 8 //ini_set("xdebug.profiler_enable","1"); 5 9 6 10 $c = $_POST['c']; … … 53 57 $_GET['c'] = $c; 54 58 55 global $c, $clustername, $cluster ;59 global $c, $clustername, $cluster, $mySession; 56 60 57 61 include_once "./libtoga.php"; 58 62 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(); 134 135 global $jobs, $metrics; 136 137 $data_gatherer = new DataGatherer( $clustername ); 138 $data_gatherer->parseXML( &$_SESSION['data'] ); 139 140 $heartbeat = &$data_gatherer->getHeartbeat(); 141 $jobs = &$data_gatherer->getJobs(); 142 //$gnodes = $data_gatherer->getNodes(); 143 $cpus = &$data_gatherer->getCpus(); 144 $use_fqdn = &$data_gatherer->getUsingFQDN(); 63 64 global $jobs, $metrics, $session; 65 66 //printf( "c %s\n", $clustername ); 67 68 $mySession = new SessionHandler( $clustername ); 69 $mySession->checkSession(); 70 71 $session = &$mySession->getSession(); 72 $myXML = $session['data']; 73 74 //printf( "gt %s\n", $session['gather_time'] ); 75 //printf( "pi %s\n", $session['poll_interval'] ); 76 77 $myData = new DataGatherer( $clustername ); 78 $myData->parseXML( $myXML ); 79 80 $mySession->updatePollInterval( $myData->getPollInterval() ); 81 //printf( "pi %s\n", $myData->getPollInterval() ); 82 //printf( "pi %s\n", $session['poll_interval'] ); 83 $mySession->endSession(); 84 85 86 $heartbeat = &$myData->getHeartbeat(); 87 $jobs = &$myData->getJobs(); 88 $cpus = &$myData->getCpus(); 89 $use_fqdn = &$myData->getUsingFQDN(); 90 91 //print_r( $jobs ); 92 93 //print_r( $session ); 145 94 146 95 // The ext grid script will send a task field which will specify what it wants to do … … 518 467 { 519 468 global $jobs, $jobids, $clustername, $metrics, $jid, $p_metricname; 520 global $always_timestamp, $always_constant ;469 global $always_timestamp, $always_constant, $mySession; 521 470 522 471 $display_nodes = array(); … … 566 515 $poll_interval = (int) $jobs[$jid]['poll_interval']; 567 516 568 checkSessionPollInterval( $poll_interval );517 //$mySession->updatePollInterval( $poll_interval ); 569 518 570 519 $time = time(); … … 636 585 global $jobs, $hearbeat, $pstart, $pend; 637 586 global $sortfield, $sortorder, $query, $host; 638 global $jid, $owner, $queue, $status ;587 global $jid, $owner, $queue, $status, $mySession; 639 588 640 589 $job_count = count( $jobs ); … … 686 635 $poll_interval = (int) $jobs[$jobid]['poll_interval']; 687 636 688 checkSessionPollInterval( $poll_interval );637 //$mySession->updatePollInterval( $poll_interval ); 689 638 690 639 if( $jr['status'] == 'R' )
Note: See TracChangeset
for help on using the changeset viewer.