Changeset 776 for branches/0.4/web/addons
- Timestamp:
- 03/29/13 15:00:12 (11 years ago)
- Location:
- branches/0.4/web/addons/job_monarch
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/0.4/web/addons/job_monarch/index.php
r758 r776 236 236 } 237 237 238 if (!count($metrics) )238 if (!count($metrics) && $view!='search') 239 239 { 240 240 echo "<h4>Cannot find any metrics for selected cluster \"$clustername\", exiting.</h4>\n"; -
branches/0.4/web/addons/job_monarch/search.php
r716 r776 23 23 */ 24 24 25 global $clustername, $tpl, $m, $metric; 25 include_once "./dwoo/dwooAutoload.php"; 26 27 global $dwoo; 28 29 global $clustername, $m, $metric; 26 30 27 31 function validateFormInput() { 28 global $clustername, $ tpl, $id, $owner, $name, $start_from_time, $start_to_time, $queue;29 global $end_from_time, $end_to_time, $period_start, $period_stop ;32 global $clustername, $dwoo, $id, $owner, $name, $start_from_time, $start_to_time, $queue; 33 global $end_from_time, $end_to_time, $period_start, $period_stop, $tpl_data; 30 34 31 35 $error = 0; … … 76 80 // doe checks en set error en error_msg in case shit 77 81 78 if( $show_msg )79 $tpl->assign( "form_error_msg", $error_msg );82 //if( $show_msg ) 83 //$tpl_data->assign( "form_error_msg", $error_msg ); 80 84 81 85 return ($error ? 0 : 1 ); … … 229 233 230 234 function makeSearchPage() { 231 global $clustername, $ tpl, $id, $owner, $name, $start_from_time, $start_to_time, $queue;235 global $clustername, $dwoo, $id, $owner, $name, $start_from_time, $start_to_time, $queue; 232 236 global $end_from_time, $end_to_time, $filter, $default_showhosts, $m, $hosts_up, $hc; 233 237 global $period_start, $period_stop, $sortby, $sortorder, $COLUMN_REQUESTED_MEMORY; … … 239 243 makeHeader( 'search', $title, $longtitle ); 240 244 241 $tpl->assign( "cluster", $clustername ); 242 $tpl->assign( "id_value", $id ); 243 $tpl->assign( "owner_value", $owner); 244 $tpl->assign( "queue_value", $queue ); 245 $tpl->assign( "name_value", $name ); 246 $tpl->assign( "start_from_value", rawurldecode( $start_from_time ) ); 247 $tpl->assign( "start_to_value", rawurldecode( $start_to_time ) ); 248 $tpl->assign( "end_from_value", rawurldecode( $end_from_time ) ); 249 $tpl->assign( "end_to_value", rawurldecode( $end_to_time ) ); 245 $tpl = new Dwoo_Template_File("templates/search.tpl"); 246 $tpl_data = new Dwoo_Data(); 247 248 $tpl_data->assign( "cluster", $clustername ); 249 $tpl_data->assign( "id_value", $id ); 250 $tpl_data->assign( "owner_value", $owner); 251 $tpl_data->assign( "queue_value", $queue ); 252 $tpl_data->assign( "name_value", $name ); 253 $tpl_data->assign( "start_from_value", rawurldecode( $start_from_time ) ); 254 $tpl_data->assign( "start_to_value", rawurldecode( $start_to_time ) ); 255 $tpl_data->assign( "end_from_value", rawurldecode( $end_from_time ) ); 256 $tpl_data->assign( "end_to_value", rawurldecode( $end_to_time ) ); 250 257 251 258 if( validateFormInput() ) { 252 259 253 $tpl ->newBlock( "search_results" );254 $tpl ->assign( "sortby", $sortby);255 $tpl ->assign( "sortorder", $sortorder);260 $tpl_data->assign( "search_results", "yes" ); 261 $tpl_data->assign( "sortby", $sortby); 262 $tpl_data->assign( "sortorder", $sortorder); 256 263 $tdb = new TarchDbase( "127.0.0.1" ); 257 264 if( $start_from_time ) $start_from_time = datetimeToEpoch( $start_from_time ); … … 262 269 263 270 if( ($tdb->resultcount) > (int) $SEARCH_RESULT_LIMIT ) { 264 $tpl->gotoBlock( "_ROOT" );265 271 266 $tpl->assign( "form_error_msg", "Got " . $tdb->resultcount . " search results, output limited to last " . $SEARCH_RESULT_LIMIT . " jobs." ); 267 $tpl->gotoBlock( "search_results" ); 272 $tpl_data->assign( "form_error_msg", "Got " . $tdb->resultcount . " search results, output limited to last " . $SEARCH_RESULT_LIMIT . " jobs." ); 268 273 } 269 274 … … 280 285 281 286 if( $COLUMN_REQUESTED_MEMORY ) { 282 $tpl ->newBlock( "column_header_req_mem" );287 $tpl_data->assign( "column_header_req_mem", "yes" ); 283 288 } 284 289 if( $COLUMN_NODES ) { 285 $tpl ->newBlock( "column_header_nodes" );290 $tpl_data->assign( "column_header_nodes", "yes" ); 286 291 } 287 292 288 293 $sorted_search = sortJobs( $jobs, $nodes, $sortby, $sortorder ); 289 294 295 $node_loop = array(); 290 296 foreach( $sorted_search as $sortid ) { 291 297 … … 293 299 $foundid = $job['id']; 294 300 295 $ tpl->newBlock( "node");296 $ tpl->assign( "id", $job['id'] );297 $ tpl->assign( "state", $job['status'] );298 $ tpl->assign( "owner", $job['owner'] );299 $ tpl->assign( "queue", $job['queue'] );300 $ tpl->assign( "name", $job['name'] );301 $ tpl->assign( "req_cpu", makeTime( TimeToEpoch( $job['requested_time'] )) );301 $node_list = array(); 302 $node_list["id"]= $job['id']; 303 $node_list["state"]= $job['status']; 304 $node_list["owner"]= $job['owner']; 305 $node_list["queue"]= $job['queue']; 306 $node_list["name"]= $job['name']; 307 $node_list["req_cpu"]= makeTime( TimeToEpoch( $job['requested_time'] ) ); 302 308 303 309 if( $COLUMN_REQUESTED_MEMORY ) { 304 $tpl->newBlock( "column_req_mem" ); 305 $tpl->assign( "req_memory", $job['requested_memory'] ); 306 $tpl->gotoBlock( "node" ); 310 $node_list["column_req_mem"] = "yes"; 311 $node_list["req_memory"]= $job['requested_memory']; 307 312 } 308 313 if( $COLUMN_NODES) { … … 313 318 $job_nodes[] = $mynode['hostname']; 314 319 315 $ tpl->newBlock( "column_nodes" );320 $node_list["column_nodes"] = "yes"; 316 321 $nodes_hostnames = implode( " ", $job_nodes ); 317 $tpl->assign( "nodes_hostnames", $nodes_hostnames ); 318 $tpl->gotoBlock( "node" ); 322 $node_list["nodes_hostnames"]= $nodes_hostnames; 319 323 } 320 324 … … 323 327 if( $even ) { 324 328 325 $ tpl->assign("nodeclass", "even");329 $node_list["nodeclass"]= "even"; 326 330 $even = 0; 327 331 } else { 328 332 329 $ tpl->assign("nodeclass", "odd");333 $node_list["nodeclass"]= "odd"; 330 334 $even = 1; 331 335 } … … 334 338 $cpus = $nodes_nr * $ppn; 335 339 336 $ tpl->assign( "nodes", $nodes_nr );337 $ tpl->assign( "cpus", $cpus );340 $node_list["nodes"]= $nodes_nr; 341 $node_list["cpus"]= $cpus; 338 342 339 343 $job_start = $job['start_timestamp']; 340 344 $job_stop = $job['stop_timestamp']; 341 345 $runningtime = intval( $job_stop - $job_start ); 342 $ tpl->assign( "started", makeDate( $job_start ));343 $ tpl->assign( "finished", makeDate( $job_stop ));344 $ tpl->assign( "runningtime", makeTime( $runningtime ));346 $node_list["started"]= makeDate( $job_start ); 347 $node_list["finished"]= makeDate( $job_stop ); 348 $node_list["runningtime"]= makeTime( $runningtime ); 345 349 346 } 350 $node_loop[]=$node_list; 351 } 352 $tpl_data->assign("node_loop", $node_loop ); 347 353 348 354 if( count( $search_ids ) == 1 ) { 349 355 350 $tpl ->newBlock( "showhosts" );356 $tpl_data->assign( "showhosts", "yes" ); 351 357 352 358 $showhosts = isset($sh) ? $sh : $default_showhosts; 353 $tpl ->assign("checked$showhosts", "checked");359 $tpl_data->assign("checked$showhosts", "checked"); 354 360 355 361 # Present a width list … … 366 372 $cols_menu .= "</SELECT>\n"; 367 373 368 $tpl ->assign("metric","$metricname $units");369 $tpl ->assign("id", $id);374 $tpl_data->assign("metric","$metricname $units"); 375 $tpl_data->assign("id", $id); 370 376 # Host columns menu defined in header.php 371 $tpl ->assign("cols_menu", $cols_menu);377 $tpl_data->assign("cols_menu", $cols_menu); 372 378 373 379 if( $showhosts ) { … … 383 389 $period_stop = datetimeToEpoch( $period_stop ); 384 390 385 $tpl->gotoBlock( "timeperiod" ); 386 387 $tpl->assign("period_start", epochToDatetime( $period_start ) ); 388 $tpl->assign("period_stop", epochToDatetime( $period_stop ) ); 389 390 $tpl->gotoBlock( "_ROOT" ); 391 # $tpl_data->gotoBlock( "timeperiod" ); 392 393 #$tpl_data->assign("period_start", epochToDatetime( $period_start ) ); 394 #$tpl_data->assign("period_stop", epochToDatetime( $period_stop ) ); 391 395 392 396 $hosts_up = array(); … … 427 431 list($min, $max) = find_limits($sorted_hosts, $metricname); 428 432 433 $sorted_loop = array(); 429 434 # Second pass to output the graphs or metrics. 430 435 $i = 1; 431 436 foreach ( $sorted_hosts as $host=>$value ) { 432 $ tpl->newBlock ("sorted_list");437 $sorted_list = array(); 433 438 $host_url = rawurlencode($host); 434 439 $cluster_url = rawurlencode($clustername); … … 442 447 $textval = date("r", $val['VAL']); 443 448 } elseif ($val['TYPE']=="string" or $val['SLOPE']=="zero" or $always_constant[$metricname] or ($max_graphs > 0 and $i > $max_graphs )) { 444 $textval = "$val['VAL'] $val['UNITS']";449 $textval = $val['VAL']." ".$val['UNITS']; 445 450 } else { 446 $graphargs = "z=small&c=$cluster_url&m=$metricname&h=$host_url&v= $val['VAL']&x=$max&n=$min&job_start=$job_start&job_stop=$job_stop&period_start=$period_start&period_stop=$period_stop&min=$min&max=$max";451 $graphargs = "z=small&c=$cluster_url&m=$metricname&h=$host_url&v=".$val['VAL']."&x=$max&n=$min&job_start=$job_start&job_stop=$job_stop&period_start=$period_start&period_stop=$period_stop&min=$min&max=$max"; 447 452 } 448 453 if ($textval) { … … 452 457 } 453 458 454 $ tpl->assign("metric_image", $cell);459 $sorted_list["metric_image"]= $cell; 455 460 if (! ($i++ % $hostcols) ) 456 $tpl->assign ("br", "</tr><tr>"); 461 $sorted_list["br"]= "</tr><tr>"; 462 463 $sorted_loop[]=$sorted_list; 457 464 } 465 $tpl_data->assign("sorted_loop", $sorted_loop ); 458 466 459 467 } … … 461 469 462 470 } 471 $dwoo->output($tpl, $tpl_data); 463 472 } 464 473 ?> -
branches/0.4/web/addons/job_monarch/templates/header.tpl
r753 r776 81 81 {if "$search" == "yes"} 82 82 <TD align="right"><CENTER> 83 <A HREF="./?c={$cluster_url}& view=search">83 <A HREF="./?c={$cluster_url}&j_view=search"> 84 84 <B><I>Jobarchive</I></B><BR> 85 85 <IMG SRC="./document_archive.jpg" HEIGHT=100 ALT="Search the archive for {$cluster}" TITLE="Search the archive for {$cluster}" BORDER=0></A></CENTER> -
branches/0.4/web/addons/job_monarch/templates/search.tpl
r711 r776 86 86 </TD> 87 87 <TD> 88 <INPUT TYPE="TEXT" NAME="id" VALUE="{ id_value}">88 <INPUT TYPE="TEXT" NAME="id" VALUE="{$id_value}"> 89 89 </TD> 90 90 … … 97 97 </TD> 98 98 <TD> 99 <INPUT TYPE="TEXT" NAME="owner" VALUE="{ owner_value}">99 <INPUT TYPE="TEXT" NAME="owner" VALUE="{$owner_value}"> 100 100 </TD> 101 101 … … 104 104 </TD> 105 105 <TD> 106 <INPUT TYPE="TEXT" NAME="queue" VALUE="{ queue_value}">106 <INPUT TYPE="TEXT" NAME="queue" VALUE="{$queue_value}"> 107 107 </TD> 108 108 … … 111 111 </TD> 112 112 <TD> 113 <INPUT TYPE="TEXT" NAME="name" VALUE="{ name_value}">113 <INPUT TYPE="TEXT" NAME="name" VALUE="{$name_value}"> 114 114 </TD> 115 115 … … 127 127 </TD> 128 128 <TD> 129 <INPUT TYPE="HIDDEN" NAME="start_from_time" VALUE="{ start_from_value}">130 <INPUT TYPE="TEXT" NAME="start_from_pick" VALUE="{ start_from_value}" DISABLED="TRUE">129 <INPUT TYPE="HIDDEN" NAME="start_from_time" VALUE="{$start_from_value}"> 130 <INPUT TYPE="TEXT" NAME="start_from_pick" VALUE="{$start_from_value}" DISABLED="TRUE"> 131 131 <A HREF="javascript:show_calendar('document.archive_search_form.start_from_pick', document.archive_search_form.start_from_pick.value );"> 132 132 <IMG SRC="cal.gif" width="16" height="16" border="0" title="Click to select a date/time" alt="Click to select a date/time"></a> … … 138 138 </TD> 139 139 <TD> 140 <INPUT TYPE="HIDDEN" NAME="start_to_time" VALUE="{ start_to_value}">141 <INPUT TYPE="TEXT" NAME="start_to_pick" VALUE="{ start_to_value}" DISABLED="TRUE">140 <INPUT TYPE="HIDDEN" NAME="start_to_time" VALUE="{$start_to_value}"> 141 <INPUT TYPE="TEXT" NAME="start_to_pick" VALUE="{$start_to_value}" DISABLED="TRUE"> 142 142 <a href="javascript:show_calendar('document.archive_search_form.start_to_pick', document.archive_search_form.start_to_pick.value );"> 143 143 <img src="cal.gif" width="16" height="16" border="0" title="Click to select a date/time" alt="Click to select a date/time"></a> … … 159 159 </TD> 160 160 <TD> 161 <INPUT TYPE="HIDDEN" NAME="end_from_time" VALUE="{ end_from_value}">162 <INPUT TYPE="TEXT" NAME="end_from_pick" VALUE="{ end_from_value}" DISABLED="TRUE">161 <INPUT TYPE="HIDDEN" NAME="end_from_time" VALUE="{$end_from_value}"> 162 <INPUT TYPE="TEXT" NAME="end_from_pick" VALUE="{$end_from_value}" DISABLED="TRUE"> 163 163 <A HREF="javascript:show_calendar('document.archive_search_form.end_from_pick', document.archive_search_form.end_from_pick.value );"> 164 164 <IMG SRC="cal.gif" width="16" height="16" border="0" title="Click to select a date/time" alt="Click to select a date/time"></a> … … 171 171 </TD> 172 172 <TD> 173 <INPUT TYPE="HIDDEN" NAME="end_to_time" VALUE="{ end_to_value}">174 <INPUT TYPE="TEXT" NAME="end_to_pick" VALUE="{ end_to_value}" DISABLED="TRUE">173 <INPUT TYPE="HIDDEN" NAME="end_to_time" VALUE="{$end_to_value}"> 174 <INPUT TYPE="TEXT" NAME="end_to_pick" VALUE="{$end_to_value}" DISABLED="TRUE"> 175 175 <a href="javascript:show_calendar('document.archive_search_form.end_to_pick', document.archive_search_form.end_to_pick.value );"> 176 176 <img src="cal.gif" width="16" height="16" border="0" title="Click to select a date/time" alt="Click to select a date/time"></a> … … 195 195 196 196 </TABLE> 197 {form_error_msg}<BR><BR> 198 <!-- START BLOCK : search_results --> 199 200 <INPUT TYPE="HIDDEN" NAME="sortby" VALUE="{sortby}"> 201 <INPUT TYPE="HIDDEN" NAME="sortorder" VALUE="{sortorder}"> 202 <INPUT TYPE="HIDDEN" NAME="filterorder" VALUE="{order}"> 197 {$form_error_msg}<BR><BR> 198 199 {if "$search_results" == " yes" } 200 201 <INPUT TYPE="HIDDEN" NAME="sortby" VALUE="{$sortby}"> 202 <INPUT TYPE="HIDDEN" NAME="sortorder" VALUE="{$sortorder}"> 203 <INPUT TYPE="HIDDEN" NAME="filterorder" VALUE="{$order}"> 203 204 204 205 <TABLE WIDTH="100%" CELLPADDING="2" CELLSPACING="2" BORDER=0> … … 210 211 <TH><B><A HREF="#" onClick="setSort( 'name' )" ALT="Jobname" TITLE="Jobname">Name</A></B></TH> 211 212 <TH><B><A HREF="#" onClick="setSort( 'req_cpu' )" ALT="Requested CPU Time (walltime)" TITLE="Requested CPU Time (walltime)">Req. CPU time</A></B></TH> 212 <!-- START BLOCK : column_header_req_mem --> 213 {if "$column_header_req_mem" == "yes"} 213 214 <TH><B><A HREF="#" onClick="setSort( 'req_mem' )" ALT="Requested Memory" TITLE="Requested Memory">Req. Memory</A></B></TH> 214 <!-- END BLOCK : column_header_req_mem --> 215 {/if} 215 216 <TH><B><A HREF="#" onClick="setSort( 'nodes' )" ALT="Nodes" TITLE="Nodes">N</A>/<A HREF="#" onClick="setSort( 'cpus' )" ALT="Processors" TITLE="Processors">P</A></B></TH> 216 <!-- START BLOCK : column_header_nodes --> 217 {if "$column_header_nodes" == "yes"} 217 218 <TH><B><A HREF="#" onClick="setSort( 'nodes' )" ALT="Nodes" TITLE="Nodes">Nodes</A></B></TH> 218 <!-- END BLOCK : column_header_nodes --> 219 {/if} 219 220 <TH><B><A HREF="#" onClick="setSort( 'start' )">Started</A></B></TH> 220 221 <TH><B><A HREF="#" onClick="setSort( 'finished' )">Finished</A></B></TH> … … 222 223 </TR> 223 224 224 <!-- START BLOCK : node --> 225 <TR CLASS="{ nodeclass}">226 <TD><A HREF="#" onClick="setFilter( 'id', '{ id}' )">{id}</A></TD>227 <TD><A HREF="#" onClick="setFilter( 'state', '{ state}' )">{state}</A></TD>228 <TD><A HREF="#" onClick="setFilter( 'owner', '{ owner}' )">{owner}</A></TD>229 <TD><A HREF="#" onClick="setFilter( 'queue', '{ queue}' )">{queue}</A></TD>230 <TD ALT="{ fulljobname}" TITLE="{fulljobname}">231 <!-- START BLOCK : jobname_hint_start --> 225 {loop $node} 226 <TR CLASS="{$nodeclass}"> 227 <TD><A HREF="#" onClick="setFilter( 'id', '{$id}' )">{$id}</A></TD> 228 <TD><A HREF="#" onClick="setFilter( 'state', '{$state}' )">{$state}</A></TD> 229 <TD><A HREF="#" onClick="setFilter( 'owner', '{$owner}' )">{$owner}</A></TD> 230 <TD><A HREF="#" onClick="setFilter( 'queue', '{$queue}' )">{$queue}</A></TD> 231 <TD ALT="{$fulljobname}" TITLE="{$fulljobname}"> 232 {if "$jobname_hint_start" == "yes"} 232 233 <FONT CLASS="jobname_hint"> 233 <!-- END BLOCK : jobname_hint_start --> 234 { name}235 <!-- START BLOCK : jobname_hint_end --> 234 {/if} 235 {$name} 236 {if "$jobname_hint_end" == "yes"} 236 237 </FONT> 237 <!-- END BLOCK : jobname_hint_end --> 238 {/if} 238 239 </TD> 239 <TD>{ req_cpu}</TD>240 <!-- START BLOCK : column_req_mem --> 241 <TD>{ req_memory}</TD>242 <!-- END BLOCK : column_req_mem --> 243 <TD>{ nodes}/{cpus}</TD>244 <!-- START BLOCK : column_nodes --> 245 <TD>{ nodes_hostnames}</TD>246 <!-- END BLOCK : column_nodes --> 247 <TD>{ started}</TD>248 <TD>{ finished}</TD>249 <TD>{ runningtime}</TD>240 <TD>{$req_cpu}</TD> 241 {if "$column_req_mem" == "yes"} 242 <TD>{$req_memory}</TD> 243 {/if} 244 <TD>{$nodes}/{$cpus}</TD> 245 {if "$column_req_mem" == "yes"} 246 <TD>{$nodes_hostnames}</TD> 247 {/if} 248 <TD>{$started}</TD> 249 <TD>{$finished}</TD> 250 <TD>{$runningtime}</TD> 250 251 </TR> 251 <!-- END BLOCK : node --> 252 {/loop} 252 253 </TABLE> 253 254 </CENTER> 254 255 255 <!-- START BLOCK : showhosts --> 256 {if "$showhosts" == "yes" } 256 257 <TABLE BORDER="0" WIDTH="100%"> 257 258 <TR> … … 259 260 <FONT SIZE="-1"> 260 261 Show Hosts: 261 yes<INPUT type=radio name="sh" value="1" OnClick="archive_search_form.submit();" { checked1}>262 no<INPUT type=radio name="sh" value="0" OnClick="archive_search_form.submit();" { checked0}>262 yes<INPUT type=radio name="sh" value="1" OnClick="archive_search_form.submit();" {$checked1}> 263 no<INPUT type=radio name="sh" value="0" OnClick="archive_search_form.submit();" {$checked0}> 263 264 </FONT> 264 265 | 265 job <strong>{ id}</strong> metric <strong>{metric}</strong>266 job <strong>{$id}</strong> metric <strong>{$metric}</strong> 266 267 | 267 268 <FONT SIZE="-1"> 268 Columns { cols_menu}269 Columns {$cols_menu} 269 270 </FONT><BR> 270 271 </TD> … … 276 277 <TABLE> 277 278 <TR> 278 <!-- START BLOCK : sorted_list --> 279 { metric_image}{br}280 <!-- END BLOCK : sorted_list --> 279 {loop $sorted_list} 280 {$metric_image}{$br} 281 {/loop} 281 282 </TR> 282 283 </TABLE> … … 284 285 </CENTER> 285 286 286 <!-- END BLOCK : showhosts --> 287 <!-- END BLOCK : search_results --> 287 {/if} 288 {/if} 288 289 </CENTER>
Note: See TracChangeset
for help on using the changeset viewer.