Changeset 713 for branches/0.4/web/addons/job_monarch/search.php
- Timestamp:
- 03/21/13 21:19:07 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/0.4/web/addons/job_monarch/search.php
r712 r713 4 4 * This file is part of Jobmonarch 5 5 * 6 * Copyright (C) 2006 Ramon Bastiaans6 * Copyright (C) 2006-2013 Ramon Bastiaans 7 7 * 8 8 * Jobmonarch is free software; you can redistribute it and/or modify … … 41 41 } 42 42 43 if( !is_numeric($id) and !$error and $id != '') { 43 if( !is_numeric($id) and !$error and $id != '') 44 { 44 45 45 46 $error = 1; … … 48 49 } 49 50 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 { 54 53 $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 { 57 56 58 57 $pstop_epoch = datetimeToEpoch( $period_stop ); 59 //printf( "pstop_epoch = %s pstart_epoch = %s\n", $pstop_epoch, $pstart_epoch );60 58 61 59 if( $pstart_epoch > $pstop_epoch ) { … … 84 82 } 85 83 86 //function makeDate( $time ) {87 // return strftime( "%a %d %b %Y %H:%M:%S", $time );88 //}89 90 84 function datetimeToEpoch( $datetime ) { 91 85 92 //printf("datetime = %s\n", $datetime );93 86 $datetime_fields = explode( ' ', $datetime ); 94 87 … … 102 95 $years = $date_fields[2]; 103 96 104 //printf( "days = %s months = %s years = %s\n", $days, $months, $years );105 106 97 $time_fields = explode( ':', $time ); 107 98 … … 110 101 $seconds = $time_fields[2]; 111 102 112 //printf( "hours = %s minutes = %s seconds = %s\n", $hours, $minutes, $seconds );113 114 103 $timestamp = mktime( $hours, $minutes, $seconds, $months, $days, $years ); 115 116 //printf( "timestamp = %s\n", $timestamp );117 104 118 105 return $timestamp; … … 149 136 function sortJobs( $jobs, $nodes, $sortby, $sortorder ) { 150 137 151 //printf("sortby = %s sortorder = %s\n", $sortby, $sortorder );152 153 138 $sorted = array(); 154 139 … … 162 147 "else if (\$sortorder==\"asc\")". 163 148 "return ( \$a > \$b ) ? 1 : -1;" ); 164 165 //print_r( $jobs );166 149 167 150 foreach( $jobs as $jobid => $jobattrs ) { … … 237 220 } 238 221 239 //uasort( $sorted, $cmp );240 222 if( $sortorder == "asc" ) 241 223 arsort( $sorted ); 242 224 else if( $sortorder == "desc" ) 243 225 asort( $sorted ); 244 245 //print_r( $sorted );246 226 247 227 return array_keys( $sorted ); … … 253 233 global $period_start, $period_stop, $sortby, $sortorder, $COLUMN_REQUESTED_MEMORY; 254 234 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 );260 235 261 236 $longtitle = "Batch Archive Search :: Powered by Job Monarch!"; … … 298 273 $even = 1; 299 274 300 //print_r( $search_ids );301 302 275 foreach( $search_ids as $myid ) { 303 276 304 //printf( "myid %s\n", $myid );305 277 $jobs[$myid] = $tdb->getJobArray( $myid ); 306 278 $nodes[$myid] = $tdb->getNodesForJob( $myid ); … … 314 286 } 315 287 316 //print_r( $nodes );317 288 $sorted_search = sortJobs( $jobs, $nodes, $sortby, $sortorder ); 318 289 319 //print_r( $sorted_search );320 290 foreach( $sorted_search as $sortid ) { 321 291 322 292 $job = $jobs[$sortid]; 323 //print_r( $job );324 293 $foundid = $job['id']; 325 //printf( "foundid %s\n", $foundid );326 327 //$job = $tdb->getJobArray( $foundid );328 //$nodes = $tdb->getNodesForJob( $foundid );329 294 330 295 $tpl->newBlock( "node" ); … … 379 344 $tpl->assign( "runningtime", makeTime( $runningtime ) ); 380 345 381 //print_r( $job );382 //print_r( $nodes );383 346 } 384 347 … … 388 351 389 352 $showhosts = isset($sh) ? $sh : $default_showhosts; 390 //if( !$showhosts) $showhosts = $default_showhosts;391 353 $tpl->assign("checked$showhosts", "checked"); 392 354 … … 410 372 411 373 if( $showhosts ) { 412 //bla413 414 //printf("job_start = %s job_stop = %s\n", $job_start, $job_stop );415 //printf("start = %s stop = %s\n", $start, $stop );416 374 417 375 if( !$period_start ) // Add an extra 10% to graphstart … … 425 383 $period_stop = datetimeToEpoch( $period_stop ); 426 384 427 //printf("start = %s stop = %s\n", $start, $stop );428 429 385 $tpl->gotoBlock( "timeperiod" ); 430 386 … … 442 398 443 399 foreach ($hosts_up as $host ) { 444 //$host = $host. '.'.$job_domain;445 400 $cpus = $metrics[$host]["cpu_num"]['VAL']; 446 401 if (!$cpus) $cpus=1; … … 467 422 } 468 423 469 //$sorted_hosts = array_merge($down_hosts, $sorted_hosts);470 471 424 # First pass to find the max value in all graphs for this 472 425 # metric. The $start,$end variables comes from get_context.php, … … 478 431 foreach ( $sorted_hosts as $host=>$value ) { 479 432 $tpl->newBlock ("sorted_list"); 480 //$host = $host. '.'.$domain;481 433 $host_url = rawurlencode($host); 482 434 $cluster_url = rawurlencode($clustername); 483 435 484 436 $textval = ""; 485 //printf("host = %s, value = %s", $host, $value);486 //echo "$host: $value, ";487 437 $val = $metrics[$host][$metricname]; 488 438 $class = "metric"; … … 507 457 } 508 458 509 //einde bla510 459 } 511 460 }
Note: See TracChangeset
for help on using the changeset viewer.