Changeset 602


Ignore:
Timestamp:
02/16/09 23:58:17 (15 years ago)
Author:
ramonb
Message:

job_monarch/libtoga.php,
job_monarch/jobstore.php,
job_monarch/js/monarch.js:

  • changed host graph retrieval and display
Location:
trunk/web2/addons/job_monarch
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/web2/addons/job_monarch/jobstore.php

    r601 r602  
    2525$queue                  = isset($_POST['queue']) ? $_POST['queue'] : null;
    2626$host                   = isset($_POST['host']) ? $_POST['host'] : null;
     27$metricname             = isset($_POST['metricname']) ? $_POST['metricname'] : 'load_one';
    2728
    2829if( $jids != null )
     
    431432function getNodes()
    432433{
    433         global $jobs, $jobids, $clustername, $metrics, $jid;
     434        global $jobs, $jobids, $clustername, $metrics, $jid, $metricname;
     435        global $always_timestamp, $always_constant;
    434436
    435437        $display_nodes  = array();
     
    439441        if( !$jobids && !$jid )
    440442        {
     443                // RB: todo replace with 0 result rows
     444                //
    441445                printf("no jobid(s)\n");
    442446                return 1;
     
    457461        {
    458462                $nr             = array();
    459                 $nr['c']        = $clustername;
    460                 $nr['h']        = $host ;
    461                 $nr['x']        = '5';
    462                 $nr['v']        = '0';
    463463
    464464                $cpus           = $metrics[$host]['cpu_num']['VAL'];
     465
     466                //print_r( $jobs[$jid] );
    465467
    466468                if ( !$cpus )
     
    473475                $load_color     = load_color($load);
    474476
    475                 $nr['l']        = $load_color;
    476 
    477                 $job_runtime    = (int) $jobs[$jid]['reported'] - (int) $jobs[$jid]['start_timestamp'];
    478                 $job_window     = intval($job_runtime * 1.2);
    479 
    480                 $nr['jr']       = -$job_window;
    481                 $nr['js']       = (int) $jobs[$jid]['start_timestamp'];
     477
     478                // RB: something broken here with JR / JS
     479                //
     480                //$job_runtime  = intval( $jobs[$jid]['reported'] ) - intval( $jobs[$jid]['start_timestamp'] );
     481                $job_runtime    = date( 'u' ) - intval( $jobs[$jid]['start_timestamp'] );
     482                $job_window     = intval( $job_runtime ) * 1.2;
     483
     484                $jobrange       = -$job_window;
     485                $jobstart       = $jobs[$jid]['start_timestamp'];
     486
    482487                $nr['jid']      = $jid;
     488
     489                $hostar         = array( $host );
     490
     491                list($min,$max) = find_limits( $hostar, $metricname );
     492
     493                $host_url       = rawurlencode( $host );
     494                $cluster_url    = rawurlencode( $clustername );
     495
     496                $textval        = "";
     497
     498                $val            = $metrics[$host][$metricname];
     499
     500                // RB: haven't used this yet: link to Ganglia's host overview
     501                // maybe later to popup?
     502                //
     503                //$host_link      = "\"../../?c=$cluster_url&h=$host_url&r=job&jr=$jobrange&js=$jobstart\"";
     504
     505                if ( $val["TYPE"] == "timestamp" || $always_timestamp[$metricname] )
     506                {
     507                        $textval        = date( "r", $val["VAL"] );
     508                }
     509                elseif ( $val["TYPE"] == "string" || $val["SLOPE"] == "zero" || $always_constant[$metricname] )
     510                {
     511                        $textval        = $val["VAL"] . " " . $val["UNITS"];
     512                }
     513                else
     514                {
     515                        $graphargs      = ($reports[$metricname]) ? "g=$metricname&" : "m=$metricname&";
     516                        $graphargs      .= "c=$cluster_url&h=$host_url&l=$load_color&v=".$val['VAL']."&r=job&jr=$jobrange&js=$jobstart";
     517
     518                        if( $max > 0 )
     519                        {
     520                                $graphargs      .= "&x=$max&n=$min";
     521                        }
     522                }
     523
     524                $nr['ga']       = $graphargs;
    483525
    484526                $node_results[] = $nr;
  • trunk/web2/addons/job_monarch/js/monarch.js

    r601 r602  
    877877                                id:             'id'
    878878                        },[
    879                                 {name: 'c', type: 'string', mapping: 'c'},
    880                                 {name: 'h', type: 'string', mapping: 'h'},
    881                                 {name: 'x', type: 'string', mapping: 'x'},
    882                                 {name: 'v', type: 'string', mapping: 'v'},
    883                                 {name: 'l', type: 'string', mapping: 'l'},
    884                                 {name: 'jr', type: 'string', mapping: 'jr'},
    885                                 {name: 'js', type: 'string', mapping: 'js'},
    886                                 {name: 'jid', type: 'string', mapping: 'jid'}
     879                                {name: 'jid', type: 'string', mapping: 'jid'},
     880                                {name: 'ga', type: 'string', mapping: 'ga'}
    887881                        ]),
    888882                        listeners:
     
    929923                                new Ext.XTemplate(
    930924                                        '<tpl for=".">',
    931                                         '<div class="rrd-float"><a href="../../graph.php?z=large&c={c}&h={h}&l={l}&v={v}\&x={x}&r=job&jr={jr}&js={js}" border="0" rel="lightbox[{jid}.{[globalWindowCount]}]"><img src="../../graph.php?z=small&c={c}&h={h}&l={l}&v={v}&x={x}&r=job&jr={jr}&js={js}" border="0"></a></div>',
     925                                        '<div class="rrd-float"><a href="../../graph.php?z=large&{ga}" border="0" rel="lightbox[{jid}.{[globalWindowCount]}]"><img src="../../graph.php?z=small&{ga}" border="0"></a></div>',
    932926                                        '</tpl>'
    933927                                )
  • trunk/web2/addons/job_monarch/libtoga.php

    r586 r602  
    120120// provide us with the correct metrics array
    121121//
    122 global $context, $clustername, $reports;
     122global $context, $clustername, $reports, $always_timestamp, $always_constant;
    123123
    124124global $default_metric;
Note: See TracChangeset for help on using the changeset viewer.