- Timestamp:
- 06/16/05 11:22:29 (18 years ago)
- Location:
- trunk/web/addons/toga
- Files:
-
- 5 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/web/addons/toga/libtoga.php
r140 r141 158 158 foreach( $result as $result_row ) 159 159 160 $nodes[] = $this->getNodeArray( $result_row[ 'id'] );160 $nodes[] = $this->getNodeArray( $result_row[node_id] ); 161 161 162 162 return $nodes; … … 171 171 foreach( $result as $result_row ) 172 172 173 $jobs[] = $this->getJobArray( $result_row[ 'id'] );173 $jobs[] = $this->getJobArray( $result_row[job_id] ); 174 174 175 175 return $jobs; … … 197 197 $map_key = explode( '_', $mykey ); 198 198 199 $newkey = $map_key[1]; 199 $rmap_key = array_reverse( $map_key ); 200 array_pop( $rmap_key ); 201 $map_key = array_reverse( $rmap_key ); 202 203 $newkey = implode( '_', $map_key ); 200 204 201 205 $myar[$newkey] = $result_row[$mykey]; … … 212 216 $this->connect(); 213 217 218 printf( "query = [%s]\n", $query ); 214 219 $result = pg_query( $this->conn, $query ); 215 220 … … 294 299 295 300 function graph( $descr ) { 301 // monitor2:/data/toga/rrds/LISA Cluster/gb-r15n11.irc.sara.nl# rrdtool graph /var/www/ganglia/test1.png --start 1118683231 --end 1118750431 --width 300 --height 400 DEF:'1'='./1118647515/load_one.rrd':'sum':AVERAGE DEF:'2'='./1118690723/load_one.rrd':'sum':AVERAGE DEF:'3'='./1118733925/load_one.rrd':'sum':AVERAGE AREA:1#555555:"load_one" AREA:2#555555 AREA:3#555555 302 // 380x461 303 // monitor2:/data/toga/rrds/LISA Cluster/gb-r15n11.irc.sara.nl# 296 304 //$command = $this->rrdbin . " graph - --start $start --end $end ". 297 305 "--width $width --height $height $upper_limit $lower_limit ". -
trunk/web/addons/toga/search.php
r140 r141 30 30 } 31 31 32 function makeTime( $time ) { 33 34 $days = intval( $time / 86400 ); 35 $time = ($days>0) ? $time % ($days * 86400) : $time; 36 37 //printf( "time = %s, days = %s\n", $time, $days ); 38 39 $date_str = ''; 40 $day_str = ''; 41 42 if( $days > 0 ) { 43 if( $days > 1 ) 44 $day_str .= $days . ' days'; 45 else 46 $day_str .= $days . ' day'; 47 } 48 49 $hours = intval( $time / 3600 ); 50 $time = $hours ? $time % ($hours * 3600) : $time; 51 52 //printf( "time = %s, days = %s, hours = %s\n", $time, $days, $hours ); 53 54 if( $hours > 0 ) { 55 $date_str .= $hours . ':'; 56 $date_unit = 'hours'; 57 } 58 59 $minutes = intval( $time / 60 ); 60 $seconds = $minutes ? $time % ($minutes * 60) : $time; 61 62 if( $minutes > 0 ) { 63 64 if( $minutes >= 10 ) 65 $date_str .= $minutes . ':'; 66 else 67 $date_str .= '0' . $minutes . ':'; 68 69 $date_unit = (!isset($date_unit)) ? 'minutes' : $date_unit; 70 } else { 71 if($hours > 0 ) { 72 $date_str .= '00:'; 73 $date_unit = (!isset($date_unit)) ? 'minutes' : $date_unit; 74 } 75 } 76 77 78 $date_unit = (!isset($date_unit)) ? 'seconds' : $date_unit; 79 80 if( $seconds > 0 ) { 81 82 if( $seconds >= 10 ) 83 $date_str .= $seconds . ' ' . $date_unit; 84 else 85 $date_str .= '0' . $seconds . ' ' . $date_unit; 86 87 } else if ( $hours > 0 or $minutes > 0 ) 88 89 $date_str .= '00 ' . $date_unit; 90 91 if( $days > 0) { 92 93 if( $hours > 0 or $minutes > 0 or $seconds > 0 ) 94 $date_str = $day_str . ' - ' . $date_str; 95 else 96 $date_str = $day_str; 97 } 98 99 return $date_str; 100 } 101 102 function makeDate( $time ) { 103 return strftime( "%a %d %b %Y %H:%M:%S", $time ); 104 } 105 106 function timeToEpoch( $time ) { 107 108 $time_fields = explode( ':', $time ); 109 110 if( count($time_fields) == 3 ) { 111 112 $hours = $time_fields[0]; 113 $minutes = $time_fields[1]; 114 $seconds = $time_fields[2]; 115 116 } else if( count($time_fields) == 2 ) { 117 118 $hours = 0; 119 $minutes = $time_fields[0]; 120 $seconds = $time_fields[1]; 121 122 } else if( count($time_fields) == 1 ) { 123 124 $hours = 0; 125 $minutes = 0; 126 $seconds = $time_fields[0]; 127 } 128 129 $myepoch = intval( $seconds + (intval( $minutes * 60 )) + (intval( $hours * 3600 )) ); 130 131 return $myepoch; 132 } 133 32 134 function makeSearchPage() { 33 135 global $clustername, $tpl, $id, $user, $name, $start_from_time, $start_to_time, $queue; … … 52 154 foreach( $search_ids as $foundid ) { 53 155 54 printf("found job %s\n", $foundid ); 156 $job = $tdb->getJobArray( $foundid ); 157 $nodes = $tdb->getNodesForJob( $foundid ); 158 159 $tpl->newBlock( "node" ); 160 $tpl->assign( "id", $job[id] ); 161 $tpl->assign( "state", $job[status] ); 162 $tpl->assign( "user", $job[owner] ); 163 $tpl->assign( "queue", $job[queue] ); 164 $tpl->assign( "name", $job[name] ); 165 $tpl->assign( "req_cpu", makeTime( TimeToEpoch( $job[requested_time] ) ) ); 166 $tpl->assign( "req_memory", $job[requested_memory] ); 167 168 $nodes_nr = count( $nodes ); 169 $domain = $job[domain]; 170 $ppn = (int) $job[ppn] ? $job[ppn] : 1; 171 $cpus = $nodes_nr * $ppn; 172 173 $tpl->assign( "nodes", $nodes_nr ); 174 $tpl->assign( "cpus", $cpus ); 175 176 $runningtime = intval( $job[stop_timestamp] - $job[start_timestamp] ); 177 $tpl->assign( "started", makeDate( $job[start_timestamp] ) ); 178 $tpl->assign( "finished", makeDate( $job[stop_timestamp] ) ); 179 $tpl->assign( "runningtime", makeTime( $runningtime ) ); 180 181 print_r( $job ); 182 print_r( $nodes ); 55 183 //output jobzooi 56 184 -
trunk/web/addons/toga/templates/search.tpl
r140 r141 1 1 <CENTER> 2 2 </FORM> 3 3 4 <SCRIPT LANGUAGE="javascript" SRC="ts_picker.js"></SCRIPT> 4 <SCRIPT TYPE="text/javascript" SRC="libtoga.js"></SCRIPT>5 <SCRIPT LANGUAGE="javascript" SRC="libtoga.js"></SCRIPT> 5 6 <SCRIPT LANGUAGE="javascript"> 6 7 … … 151 152 152 153 </TABLE> 153 </FORM>154 154 <BR><BR> 155 155 <!-- START BLOCK : search_results --> 156 <SCRIPT TYPE="text/javascript" SRC="libtoga.js"></SCRIPT>157 156 158 157 <INPUT TYPE="HIDDEN" NAME="sortby" VALUE="{sortby}"> 159 158 <INPUT TYPE="HIDDEN" NAME="sortorder" VALUE="{sortorder}"> 160 <INPUT TYPE="HIDDEN" NAME="c" VALUE="{clustername}">161 <INPUT TYPE="HIDDEN" NAME="queue" VALUE="{f_queue}">162 <INPUT TYPE="HIDDEN" NAME="state" VALUE="{f_state}">163 <INPUT TYPE="HIDDEN" NAME="user" VALUE="{f_user}">164 <INPUT TYPE="HIDDEN" NAME="id" VALUE="{f_id}">165 159 <INPUT TYPE="HIDDEN" NAME="filterorder" VALUE="{f_order}"> 166 160 … … 217 211 <INPUT TYPE="HIDDEN" NAME="start" VALUE="{start}"> 218 212 <INPUT TYPE="HIDDEN" NAME="stop" VALUE="{stop}"> 219 Set graph timeperiod from <INPUT TYPE="text" NAME="period_start_pick" VALUE="{start}" SIZE=12 ALT="Start time"><a href="javascript:show_calendar('document.search_form.period_start_pick', document.search_form.period_start_pick.value);"><img src="cal.gif" width="16" height="16" border="0"></a> to <INPUT TYPE="text" NAME="period_stop_pick" VALUE="{stop}" SIZE=12 ALT="Stop time"><a href="javascript:show_calendar('document.toga_form.period_stop_pick', document.search_form.period_stop_pick.value);"><img src="cal.gif" width="16" height="16" border="0"></a><INPUT TYPE="submit" onClick="setPeriodTimestamps();" VALUE="Refresh graphs"> 213 Set graph timeperiod from 214 <INPUT TYPE="text" NAME="period_start_pick" VALUE="{start}" SIZE=12 ALT="Start time" DISABLED="TRUE"> 215 <a href="javascript:show_calendar('document.archive_search_form.period_start_pick', document.archive_search_form.period_start_pick.value);"><img src="cal.gif" width="16" height="16" border="0"></a> 216 to <INPUT TYPE="text" NAME="period_stop_pick" VALUE="{stop}" SIZE=12 ALT="Stop time" DISABLED="TRUE"> 217 <a href="javascript:show_calendar('document.archive_search_form.period_stop_pick', document.archive_search_form.period_stop_pick.value);"><img src="cal.gif" width="16" height="16" border="0"></a> 218 <INPUT TYPE="submit" onClick="setPeriodTimestamps();" VALUE="Refresh graphs"> 220 219 </FONT> 221 220 </TD>
Note: See TracChangeset
for help on using the changeset viewer.