Changeset 713 for branches


Ignore:
Timestamp:
03/21/13 21:19:07 (11 years ago)
Author:
ramonb
Message:
  • cleanup
Location:
branches/0.4/web/addons/job_monarch
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/0.4/web/addons/job_monarch/libtoga.php

    r711 r713  
    44 * This file is part of Jobmonarch
    55 *
    6  * Copyright (C) 2006  Ramon Bastiaans
     6 * Copyright (C) 2006-2013  Ramon Bastiaans
    77 *
    88 * Jobmonarch is free software; you can redistribute it and/or modify
     
    106106chdir( $GANGLIA_PATH );
    107107
    108 //include_once "./conf.php";
    109108include_once "./eval_conf.php";
    110109include_once "./functions.php";
     
    487486                if( !$fp )
    488487                {
    489                         echo 'Unable to connect to '.$this->ip.':'.$this->port; // printf( 'Unable to connect to [%s:%.0f]', $this->ip, $this->port );
     488                        echo 'Unable to connect to '.$this->ip.':'.$this->port;
    490489                        return;
    491490                }
  • branches/0.4/web/addons/job_monarch/search.php

    r712 r713  
    44 * This file is part of Jobmonarch
    55 *
    6  * Copyright (C) 2006  Ramon Bastiaans
     6 * Copyright (C) 2006-2013  Ramon Bastiaans
    77 *
    88 * Jobmonarch is free software; you can redistribute it and/or modify
     
    4141        }
    4242
    43         if( !is_numeric($id) and !$error and $id != '') {
     43        if( !is_numeric($id) and !$error and $id != '')
     44    {
    4445
    4546                $error = 1;
     
    4849        }
    4950
    50         //printf( "period_start = %s period_stop = %s\n", $period_start, $period_stop );
    51 
    52         if( !$error and $period_start != '' ) {
    53                 //printf( "period_start = %s period_stop = %s\n", $period_start, $period_stop );
     51        if( !$error and $period_start != '' )
     52    {
    5453                $pstart_epoch = datetimeToEpoch( $period_start );
    55                 //printf( "period_start = %s period_stop = %s\n", $period_start, $period_stop );
    56                 if( $period_stop != '' ) {
     54                if( $period_stop != '' )
     55        {
    5756
    5857                        $pstop_epoch = datetimeToEpoch( $period_stop );
    59                         //printf( "pstop_epoch = %s pstart_epoch = %s\n", $pstop_epoch, $pstart_epoch );
    6058
    6159                        if( $pstart_epoch > $pstop_epoch ) {
     
    8482}
    8583
    86 //function makeDate( $time ) {
    87 //        return strftime( "%a %d %b %Y %H:%M:%S", $time );
    88 //}
    89 
    9084function datetimeToEpoch( $datetime ) {
    9185
    92         //printf("datetime = %s\n", $datetime );
    9386        $datetime_fields = explode( ' ', $datetime );
    9487
     
    10295        $years = $date_fields[2];
    10396
    104         //printf( "days = %s months = %s years = %s\n", $days, $months, $years );
    105 
    10697        $time_fields = explode( ':', $time );
    10798
     
    110101        $seconds = $time_fields[2];
    111102
    112         //printf( "hours = %s minutes = %s seconds = %s\n", $hours, $minutes, $seconds );
    113 
    114103        $timestamp = mktime( $hours, $minutes, $seconds, $months, $days, $years );
    115 
    116         //printf( "timestamp = %s\n", $timestamp );
    117104
    118105        return $timestamp;
     
    149136function sortJobs( $jobs, $nodes, $sortby, $sortorder ) {
    150137
    151         //printf("sortby = %s sortorder = %s\n", $sortby, $sortorder );
    152 
    153138        $sorted = array();
    154139
     
    162147                "else if (\$sortorder==\"asc\")".
    163148                        "return ( \$a > \$b ) ? 1 : -1;" );
    164 
    165         //print_r( $jobs );
    166149
    167150        foreach( $jobs as $jobid => $jobattrs ) {
     
    237220        }
    238221
    239         //uasort( $sorted, $cmp );
    240222        if( $sortorder == "asc" )
    241223                arsort( $sorted );
    242224        else if( $sortorder == "desc" )
    243225                asort( $sorted );
    244 
    245         //print_r( $sorted );
    246226
    247227        return array_keys( $sorted );
     
    253233        global $period_start, $period_stop, $sortby, $sortorder, $COLUMN_REQUESTED_MEMORY;
    254234        global $SEARCH_RESULT_LIMIT, $COLUMN_NODES, $metricname;
    255 
    256         //$metricname = $m;
    257         //printf("job_start = %s job_stop = %s\n", $job_start, $job_stop );
    258         //printf("start = %s stop = %s\n", $start, $stop );
    259         //printf("m %s\n", $metricname );
    260235
    261236        $longtitle = "Batch Archive Search :: Powered by Job Monarch!";
     
    298273                $even = 1;
    299274
    300                 //print_r( $search_ids );
    301 
    302275                foreach( $search_ids as $myid ) {
    303276
    304                         //printf( "myid %s\n", $myid );
    305277                        $jobs[$myid] = $tdb->getJobArray( $myid );
    306278                        $nodes[$myid] = $tdb->getNodesForJob( $myid );
     
    314286                }
    315287
    316                 //print_r( $nodes );
    317288                $sorted_search = sortJobs( $jobs, $nodes, $sortby, $sortorder );
    318289
    319                 //print_r( $sorted_search );
    320290                foreach( $sorted_search as $sortid ) {
    321291
    322292                        $job = $jobs[$sortid];
    323                         //print_r( $job );
    324293                        $foundid = $job['id'];
    325                         //printf( "foundid %s\n", $foundid );
    326 
    327                         //$job = $tdb->getJobArray( $foundid );
    328                         //$nodes = $tdb->getNodesForJob( $foundid );
    329294
    330295                        $tpl->newBlock( "node" );
     
    379344                        $tpl->assign( "runningtime", makeTime( $runningtime ) );
    380345                       
    381                         //print_r( $job );
    382                         //print_r( $nodes );
    383346                }
    384347
     
    388351
    389352                        $showhosts = isset($sh) ? $sh : $default_showhosts;
    390                         //if( !$showhosts) $showhosts = $default_showhosts;
    391353                        $tpl->assign("checked$showhosts", "checked");
    392354
     
    410372
    411373                        if( $showhosts ) {
    412                                 //bla
    413 
    414                                 //printf("job_start = %s job_stop = %s\n", $job_start, $job_stop );
    415                                 //printf("start = %s stop = %s\n", $start, $stop );
    416374
    417375                                if( !$period_start ) // Add an extra 10% to graphstart
     
    425383                                        $period_stop = datetimeToEpoch( $period_stop );
    426384
    427                                 //printf("start = %s stop = %s\n", $start, $stop );
    428 
    429385                                $tpl->gotoBlock( "timeperiod" );
    430386
     
    442398
    443399                                foreach ($hosts_up as $host ) {
    444                                         //$host = $host. '.'.$job_domain;
    445400                                        $cpus = $metrics[$host]["cpu_num"]['VAL'];
    446401                                        if (!$cpus) $cpus=1;
     
    467422                                }
    468423
    469                                 //$sorted_hosts = array_merge($down_hosts, $sorted_hosts);
    470 
    471424                                # First pass to find the max value in all graphs for this
    472425                                # metric. The $start,$end variables comes from get_context.php,
     
    478431                                foreach ( $sorted_hosts as $host=>$value  ) {
    479432                                        $tpl->newBlock ("sorted_list");
    480                                         //$host = $host. '.'.$domain;
    481433                                        $host_url = rawurlencode($host);
    482434                                        $cluster_url = rawurlencode($clustername);
    483435
    484436                                        $textval = "";
    485                                         //printf("host = %s, value = %s", $host, $value);
    486                                         //echo "$host: $value, ";
    487437                                        $val = $metrics[$host][$metricname];
    488438                                        $class = "metric";
     
    507457                                }
    508458
    509                                 //einde bla
    510459                        }
    511460                }
Note: See TracChangeset for help on using the changeset viewer.