Changeset 263 for trunk/web


Ignore:
Timestamp:
06/23/06 17:44:29 (18 years ago)
Author:
bastiaans
Message:

web/addons/job_monarch/overview.php:

  • added: &h=<host> ability: shows jobs running on that host
  • removed some old bogus code and comments
  • changed: node hostname parsing to always use fqdn. prevents additional ghost nodes from appearing

web/addons/job_monarch/index.php:

  • removed: seperate non-existant host_view parsing allows hostname argument to be parsed by overview.php
Location:
trunk/web/addons/job_monarch
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/web/addons/job_monarch/index.php

    r231 r263  
    303303        }
    304304
     305        //$ex_fn = $tpl->getVarValue( "_ROOT", "form_name" );
     306
    305307        if( $view == "search" or $view == "host" ) {
    306308
     
    375377if( isset( $h ) and $h != '' ) {
    376378        $hostname = $h;
    377         $view = "host";
     379        //$view = "host";
    378380}
    379381
     
    390392                break;
    391393
    392         case "host":
    393 
    394                 includeHostPage();
    395                 break;
     394        //case "host":
     395
     396        //      includeHostPage();
     397        //      break;
    396398
    397399        default:
     
    423425                break;
    424426
    425         case "host":
    426 
    427                 include "./host_view.php";
    428                 makeHostView();
    429                 break;
     427        //case "host":
     428
     429        //      include "./host_view.php";
     430        //      makeHostView();
     431        //      break;
    430432
    431433        default:
  • trunk/web/addons/job_monarch/overview.php

    r250 r263  
    2424
    2525global $GANGLIA_PATH, $clustername, $tpl, $filter, $cluster, $get_metric_string, $cluster_url, $sh;
    26 global $hosts_up, $m, $start, $end, $filterorder, $COLUMN_REQUESTED_MEMORY, $COLUMN_QUEUED;
    27 
    28 //$tpl->assign("_ROOT.summary", "" );
     26global $hosts_up, $m, $start, $end, $filterorder, $COLUMN_REQUESTED_MEMORY, $COLUMN_QUEUED, $hostname, $piefilter;
    2927
    3028$data_gatherer = new DataGatherer( $clustername );
    3129
    32 //$tpl->assign( "self", "./index.php" );
    3330$tpl->assign( "clustername", $clustername );
    3431
     
    4340$cpus = $data_gatherer->getCpus();
    4441
    45 $filter_image_url = "";
    46 
    47 foreach( $filter as $filtername => $filtervalue ) {
    48         $tpl->assign( "f_".$filtername, $filtervalue );
    49         $filter_image_url .= "&$filtername=$filtervalue";
    50 }
    51 
    52 $tpl->assign( "clusterimage", "./image.php?c=".rawurlencode($clustername)."&view=big-clusterimage".$filter_image_url );
    53 $tpl->assign( "f_order", $filterorder );
    54 
    55 if( array_key_exists( "id", $filter ) )
    56         $piefilter = 'id';
    57 else if( array_key_exists( "user", $filter ) )
    58         $piefilter = 'user';
    59 else if( array_key_exists( "queue", $filter ) )
    60         $piefilter = 'queue';
    61 
    62 $pie = drawPie();
    63 $tpl->assign("pie", $pie );
    64 
    65 //if( !array_key_exists( 'id', $filter ) ) {
    66 
    67 //      $graph_args = "c=$cluster_url&$get_metric_string&st=$cluster[LOCALTIME]";
    68 //      $tpl->newBlock( "average_graphs" );
    69 //      $tpl->assign( "graph_args", $graph_args );
    70 //}
     42function setupFilterSettings() {
     43        global $tpl, $filter, $clustername, $piefilter;
     44
     45        $filter_image_url = "";
     46
     47        $tpl->gotoBlock( "_ROOT" );
     48
     49        foreach( $filter as $filtername => $filtervalue ) {
     50                $tpl->assign( "f_".$filtername, $filtervalue );
     51                $filter_image_url .= "&$filtername=$filtervalue";
     52        }
     53
     54        $tpl->assign( "clusterimage", "./image.php?c=".rawurlencode($clustername)."&view=big-clusterimage".$filter_image_url );
     55        $tpl->assign( "f_order", $filterorder );
     56
     57        if( array_key_exists( "id", $filter ) )
     58                $piefilter = 'id';
     59        else if( array_key_exists( "user", $filter ) )
     60                $piefilter = 'user';
     61        else if( array_key_exists( "queue", $filter ) )
     62                $piefilter = 'queue';
     63
     64        $pie = drawPie();
     65        $tpl->assign("pie", $pie );
     66}
    7167
    7268function timeToEpoch( $time ) {
     
    470466        global $cluster_url, $get_metric_string, $host_url, $metrics;
    471467        global $start, $end, $reports, $gnodes, $default_showhosts;
    472         global $COLUMN_QUEUED, $COLUMN_REQUESTED_MEMORY;
     468        global $COLUMN_QUEUED, $COLUMN_REQUESTED_MEMORY, $hostname;
    473469        $metricname = $m;
    474470
     
    521517                $tpl->newBlock( "column_header_queued" );
    522518        }
     519
     520        $last_displayed_job = null;
    523521
    524522        foreach( $sorted_jobs as $jobid => $sortdec ) {
     
    547545                                $running_jobs++;
    548546
    549                                 foreach( $jobs[$jobid][nodes] as $tempnode )
     547                                foreach( $jobs[$jobid][nodes] as $tempnode ) {
    550548                                        $running_name_nodes[] = $tempnode;
     549
     550                                        if( isset( $hostname ) && $hostname != '' )
     551                                                //$filter[host] = $hostname;
     552
     553                                                $domain_len = 0 - strlen( $jobs[$jobid][domain] );
     554                                                $hostnode = $tempnode;
     555                                                if( substr( $hostnode, $domain_len ) != $jobs[$jobid][domain] ) {
     556                                                        $hostnode = $hostnode. '.'. $jobs[$jobid][domain];
     557                                                }
     558
     559                                                if( isset($hostname) && $hostname != '' && $hostname != $hostnode )
     560                                                        $display_job = 0;
     561                                }
    551562                        }
    552563
    553564                        if( $jobs[$jobid][status] == 'Q' ) {
     565                                if( isset( $hostname ) && $hostname != '' )
     566                                        $display_job = 0;
     567
    554568                                $queued_cpus += $cpus;
    555569                                $queued_nodes += $nodes;
     
    574588                                $tpl->assign( "clustername", $clustername );
    575589                                $tpl->assign("id", $jobid );
     590
     591                                $last_displayed_job = $jobid;
     592
    576593                                $tpl->assign("state", $jobs[$jobid][status] );
    577594
     
    672689        $total_jobs = $queued_jobs + $running_jobs;
    673690
    674         //$tpl->assignGlobal("cpus_nr", $overview_cpus );
    675         //$tpl->assignGlobal("jobs_nr", $overview_jobs );
    676 
    677691        $tpl->assignGlobal("avail_nodes", $avail_nodes );
    678692        $tpl->assignGlobal("avail_cpus", $avail_cpus );
     
    705719
    706720        $tpl->assignGlobal("report_time", makeDate( $heartbeat));
    707        
    708         //$tpl->assignGlobal("f_cpus_nr", $f_cpus );
    709         //$tpl->assignGlobal("f_jobs_nr", $f_jobs );
     721
     722        //if( intval($view_jobs) == 1 and $start_time )
     723        //      if( $last_displayed_job != null )
     724        //              $filter[id] = $last_displayed_job;
     725
     726        //makeHeader();
     727        setupFilterSettings();
    710728
    711729        if( intval($view_jobs) == 1 and $start_time ) {
     730
    712731                $tpl->newBlock( "showhosts" );
    713732
    714733                # Present a width list
    715734                $cols_menu = "<SELECT NAME=\"hc\" OnChange=\"toga_form.submit();\">\n";
     735
    716736
    717737                $hostcols = ($hc) ? $hc : 4;
     
    755775                        else
    756776                                $metricval = "m";
    757                                                
     777                               
    758778                        foreach ($hosts_up as $host ) {
    759779
Note: See TracChangeset for help on using the changeset viewer.