Ignore:
Timestamp:
03/29/13 15:00:12 (11 years ago)
Author:
ramonb
Message:
  • archive search is now also Dwoo-anized
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  
    236236    }
    237237
    238     if (!count($metrics))
     238    if (!count($metrics) && $view!='search')
    239239    {
    240240        echo "<h4>Cannot find any metrics for selected cluster \"$clustername\", exiting.</h4>\n";
  • branches/0.4/web/addons/job_monarch/search.php

    r716 r776  
    2323 */
    2424
    25 global $clustername, $tpl, $m, $metric;
     25include_once "./dwoo/dwooAutoload.php";
     26
     27global $dwoo;
     28
     29global $clustername, $m, $metric;
    2630
    2731function 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;
    3034
    3135    $error = 0;
     
    7680    // doe checks en set error en error_msg in case shit
    7781
    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 );
    8084
    8185    return ($error ? 0 : 1 );
     
    229233
    230234function 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;
    232236    global $end_from_time, $end_to_time, $filter, $default_showhosts, $m, $hosts_up, $hc;
    233237    global $period_start, $period_stop, $sortby, $sortorder, $COLUMN_REQUESTED_MEMORY;
     
    239243    makeHeader( 'search', $title, $longtitle );
    240244
    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 ) );
    250257
    251258    if( validateFormInput() ) {
    252259
    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);
    256263        $tdb = new TarchDbase( "127.0.0.1" );
    257264        if( $start_from_time ) $start_from_time = datetimeToEpoch( $start_from_time );
     
    262269
    263270        if( ($tdb->resultcount) > (int) $SEARCH_RESULT_LIMIT ) {
    264             $tpl->gotoBlock( "_ROOT" );
    265271       
    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." );
    268273        }
    269274
     
    280285
    281286        if( $COLUMN_REQUESTED_MEMORY ) {
    282             $tpl->newBlock( "column_header_req_mem" );
     287            $tpl_data->assign( "column_header_req_mem", "yes" );
    283288        }
    284289        if( $COLUMN_NODES ) {
    285             $tpl->newBlock( "column_header_nodes" );
     290            $tpl_data->assign( "column_header_nodes", "yes" );
    286291        }
    287292
    288293        $sorted_search = sortJobs( $jobs, $nodes, $sortby, $sortorder );
    289294
     295        $node_loop = array();
    290296        foreach( $sorted_search as $sortid ) {
    291297
     
    293299            $foundid = $job['id'];
    294300
    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'] ) );
    302308
    303309            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'];
    307312            }
    308313            if( $COLUMN_NODES) {
     
    313318                    $job_nodes[] = $mynode['hostname'];
    314319
    315                 $tpl->newBlock( "column_nodes" );
     320                $node_list["column_nodes"] = "yes";
    316321                $nodes_hostnames = implode( " ", $job_nodes );
    317                 $tpl->assign( "nodes_hostnames", $nodes_hostnames );
    318                 $tpl->gotoBlock( "node" );
     322                $node_list["nodes_hostnames"]= $nodes_hostnames;
    319323            }
    320324
     
    323327            if( $even ) {
    324328
    325                 $tpl->assign("nodeclass", "even");
     329                $node_list["nodeclass"]= "even";
    326330                $even = 0;
    327331            } else {
    328332
    329                 $tpl->assign("nodeclass", "odd");
     333                $node_list["nodeclass"]= "odd";
    330334                $even = 1;
    331335            }
     
    334338            $cpus = $nodes_nr * $ppn;
    335339
    336             $tpl->assign( "nodes", $nodes_nr );
    337             $tpl->assign( "cpus", $cpus );
     340            $node_list["nodes"]= $nodes_nr;
     341            $node_list["cpus"]= $cpus;
    338342
    339343            $job_start = $job['start_timestamp'];
    340344            $job_stop = $job['stop_timestamp'];
    341345            $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 );
    345349           
    346         }
     350            $node_loop[]=$node_list;
     351        }
     352        $tpl_data->assign("node_loop", $node_loop );
    347353
    348354        if( count( $search_ids ) == 1 ) {
    349355
    350             $tpl->newBlock( "showhosts" );
     356            $tpl_data->assign( "showhosts", "yes" );
    351357
    352358            $showhosts = isset($sh) ? $sh : $default_showhosts;
    353             $tpl->assign("checked$showhosts", "checked");
     359            $tpl_data->assign("checked$showhosts", "checked");
    354360
    355361            # Present a width list
     
    366372            $cols_menu .= "</SELECT>\n";
    367373
    368             $tpl->assign("metric","$metricname $units");
    369             $tpl->assign("id", $id);
     374            $tpl_data->assign("metric","$metricname $units");
     375            $tpl_data->assign("id", $id);
    370376            # Host columns menu defined in header.php
    371             $tpl->assign("cols_menu", $cols_menu);
     377            $tpl_data->assign("cols_menu", $cols_menu);
    372378
    373379            if( $showhosts ) {
     
    383389                    $period_stop = datetimeToEpoch( $period_stop );
    384390
    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 ) );
    391395
    392396                $hosts_up = array();
     
    427431                list($min, $max) = find_limits($sorted_hosts, $metricname);
    428432
     433                $sorted_loop = array();
    429434                # Second pass to output the graphs or metrics.
    430435                $i = 1;
    431436                foreach ( $sorted_hosts as $host=>$value  ) {
    432                     $tpl->newBlock ("sorted_list");
     437                    $sorted_list = array();
    433438                    $host_url = rawurlencode($host);
    434439                    $cluster_url = rawurlencode($clustername);
     
    442447                        $textval = date("r", $val['VAL']);
    443448                    } 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'];
    445450                    } 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";
    447452                    }
    448453                    if ($textval) {
     
    452457                    }
    453458
    454                     $tpl->assign("metric_image", $cell);
     459                    $sorted_list["metric_image"]= $cell;
    455460                    if (! ($i++ % $hostcols) )
    456                          $tpl->assign ("br", "</tr><tr>");
     461                         $sorted_list["br"]= "</tr><tr>";
     462
     463                    $sorted_loop[]=$sorted_list;
    457464                }
     465                $tpl_data->assign("sorted_loop", $sorted_loop );
    458466
    459467            }
     
    461469
    462470    }
     471    $dwoo->output($tpl, $tpl_data);
    463472}
    464473?>
  • branches/0.4/web/addons/job_monarch/templates/header.tpl

    r753 r776  
    8181{if "$search" == "yes"}
    8282     <TD align="right"><CENTER>
    83        <A HREF="./?c={$cluster_url}&view=search">
     83       <A HREF="./?c={$cluster_url}&j_view=search">
    8484       <B><I>Jobarchive</I></B><BR>
    8585       <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  
    8686  </TD>
    8787  <TD>
    88   <INPUT TYPE="TEXT" NAME="id" VALUE="{id_value}">
     88  <INPUT TYPE="TEXT" NAME="id" VALUE="{$id_value}">
    8989  </TD>
    9090
     
    9797  </TD>
    9898  <TD>
    99   <INPUT TYPE="TEXT" NAME="owner" VALUE="{owner_value}">
     99  <INPUT TYPE="TEXT" NAME="owner" VALUE="{$owner_value}">
    100100  </TD>
    101101
     
    104104  </TD>
    105105  <TD>
    106   <INPUT TYPE="TEXT" NAME="queue" VALUE="{queue_value}">
     106  <INPUT TYPE="TEXT" NAME="queue" VALUE="{$queue_value}">
    107107  </TD>
    108108
     
    111111  </TD>
    112112  <TD>
    113   <INPUT TYPE="TEXT" NAME="name" VALUE="{name_value}">
     113  <INPUT TYPE="TEXT" NAME="name" VALUE="{$name_value}">
    114114  </TD>
    115115
     
    127127  </TD>
    128128  <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">
    131131  <A HREF="javascript:show_calendar('document.archive_search_form.start_from_pick', document.archive_search_form.start_from_pick.value );">
    132132  <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>
     
    138138  </TD>
    139139  <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">
    142142  <a href="javascript:show_calendar('document.archive_search_form.start_to_pick', document.archive_search_form.start_to_pick.value );">
    143143  <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>
     
    159159  </TD>
    160160  <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">
    163163  <A HREF="javascript:show_calendar('document.archive_search_form.end_from_pick', document.archive_search_form.end_from_pick.value );">
    164164  <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>
     
    171171  </TD>
    172172  <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">
    175175  <a href="javascript:show_calendar('document.archive_search_form.end_to_pick', document.archive_search_form.end_to_pick.value );">
    176176  <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>
     
    195195
    196196</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}">
    203204
    204205<TABLE WIDTH="100%" CELLPADDING="2" CELLSPACING="2" BORDER=0>
     
    210211<TH><B><A HREF="#" onClick="setSort( 'name' )" ALT="Jobname" TITLE="Jobname">Name</A></B></TH>
    211212<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"}
    213214<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}
    215216<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"}
    217218<TH><B><A HREF="#" onClick="setSort( 'nodes' )" ALT="Nodes" TITLE="Nodes">Nodes</A></B></TH>
    218 <!-- END BLOCK : column_header_nodes -->
     219{/if}
    219220<TH><B><A HREF="#" onClick="setSort( 'start' )">Started</A></B></TH>
    220221<TH><B><A HREF="#" onClick="setSort( 'finished' )">Finished</A></B></TH>
     
    222223</TR>
    223224
    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"}
    232233    <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"}
    236237    </FONT>
    237 <!-- END BLOCK : jobname_hint_end -->
     238{/if}
    238239    </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>
    250251  </TR>
    251 <!-- END BLOCK : node -->
     252{/loop}
    252253</TABLE>
    253254</CENTER>
    254255
    255 <!-- START BLOCK : showhosts -->
     256{if "$showhosts" == "yes" }
    256257<TABLE BORDER="0" WIDTH="100%">
    257258<TR>
     
    259260  <FONT SIZE="-1">
    260261  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}>
    263264  </FONT>
    264265  |
    265   job <strong>{id}</strong> metric <strong>{metric}</strong>
     266  job <strong>{$id}</strong> metric <strong>{$metric}</strong>
    266267  |
    267268   <FONT SIZE="-1">
    268    Columns&nbsp;&nbsp;{cols_menu}
     269   Columns&nbsp;&nbsp;{$cols_menu}
    269270   </FONT><BR>
    270271  </TD>
     
    276277<TABLE>
    277278<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}
    281282</TR>
    282283</TABLE>
     
    284285</CENTER>
    285286
    286 <!-- END BLOCK : showhosts -->
    287 <!-- END BLOCK : search_results -->
     287{/if}
     288{/if}
    288289</CENTER>
Note: See TracChangeset for help on using the changeset viewer.