Changeset 463 for trunk/web/addons
- Timestamp:
- 02/07/08 10:35:47 (15 years ago)
- Location:
- trunk/web/addons/job_monarch
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/web/addons/job_monarch/libtoga.php
r461 r463 564 564 } 565 565 566 function getUsingFQDN() { 567 $handler = $this->xmlhandler; 568 return $handler->getUsingFQDN(); 569 } 570 566 571 function getNodes() { 567 572 $handler = $this->xmlhandler; … … 611 616 $this->clustername = $clustername; 612 617 $this->fqdn = 1; 618 } 619 620 function getUsingFQDN() { 621 622 return $this->fqdn; 613 623 } 614 624 … … 1263 1273 $skan_str = str_replace( "{x}", "%d", $skan_str ); 1264 1274 $skan_str = str_replace( "{y}", "%d", $skan_str ); 1265 //printf("ppoep = %s\n", $skan_str);1266 1275 } 1267 1276 else if( $x_present) … … 1286 1295 if( $x_present && $y_present ) 1287 1296 { 1288 //$n = sscanf( $hostname, $skan_str, $i, $j );1289 1297 if( $x_first ) 1290 1298 { … … 1295 1303 $n = sscanf( $hostname, $skan_str, $y, $x ); 1296 1304 } 1305 1297 1306 // Remove nodes that don't match 1298 1307 // 1299 1308 if( $n < 2 ) 1300 1309 { 1301 //printf( "removing node %s - x present & y present + <2 x,y matches\n", $hostname ); 1310 // This node hostname has no match for: {x} and {y} 1311 // 1302 1312 unset( $nodes[$hostname] ); 1303 1313 } … … 1306 1316 { 1307 1317 $n = sscanf( $hostname, $skan_str, $x ); 1318 1308 1319 // Remove nodes that don't match 1309 1320 // 1310 1321 if( $n < 1 ) 1311 1322 { 1312 //printf( "removing node %s - x present & !y present + <1 x match\n", $hostname ); 1323 // This node hostname has no match for: {x} 1324 // 1313 1325 unset( $nodes[$hostname] ); 1314 1326 } … … 1318 1330 { 1319 1331 $n = sscanf( $hostname, $skan_str, $y ); 1332 1320 1333 // Remove nodes that don't match 1321 1334 // 1322 1335 if( $n < 1 ) 1323 1336 { 1324 //printf( "removing node %s - y present & !x present + <1 y match\n", $hostname ); 1337 // This node hostname has no match for: {y} 1338 // 1325 1339 unset( $nodes[$hostname] ); 1326 1340 } 1327 1341 $x = 1; 1328 1342 } 1329 //printf( "xfirst %s yfirst %s\n", $x_first, $y_first ); 1330 1331 //printf( "n %s\n", $n ); 1332 1333 1334 //printf( "node %s x_min %s x %s\n", $hostname, $x_min, $x ); 1335 1343 1344 // Determine the lowest value of {x} that exists in all node hostnames 1345 // 1336 1346 if( !$x_min && $x != null ) 1337 1347 { … … 1342 1352 $x_min = $x; 1343 1353 } 1354 1355 // Determine the highest value of {x} that exists in all node hostnames 1356 // 1344 1357 if( !$x_max && $x != null ) 1345 1358 { … … 1350 1363 $x_max = $x; 1351 1364 } 1365 1366 // Determine the lowest value of {y} that exists in all node hostnames 1367 // 1352 1368 if( !$y_min && $y != null ) 1353 1369 { … … 1358 1374 $y_min = $y; 1359 1375 } 1376 1377 // Determine the highest value of {y} that exists in all node hostnames 1378 // 1360 1379 if( !$y_max && $y != null ) 1361 1380 { … … 1368 1387 } 1369 1388 1370 //printf( "ss %s\n", $skan_str); 1389 // Sort all the nodes (alpha and numerically) 1390 // 1: gb-r1n1, 2: gb-r1n2, 3: gb-r2n1, etc 1391 // 1371 1392 $sorted_nodes = usort( $nodes, "cmp" ); 1372 1373 //print_r( $nodes );1374 1393 1375 1394 $cur_node = 0; … … 1427 1446 if( $this->isSmall() ) { 1428 1447 1448 // Draw a fancy little header text to explain what it is 1449 // 1429 1450 $colorblue = imageColorAllocate( $image, 0, 0, 255 ); 1430 1451 … … 1438 1459 if( isset( $SORT_XLABEL ) ) 1439 1460 { 1461 // Print the {x} label: rack 1462 // 1440 1463 imageString( $image, $font, $x_offset, $fontspaceing, $SORT_XLABEL, $colorblue ); 1441 1464 } … … 1443 1466 if( isset( $SORT_YLABEL ) ) 1444 1467 { 1445 // Stupid php without imageStringDown function 1468 // Stupid php without imageStringDown function... we'll make one ourself 1469 // 1470 1471 // Print the {y} label: node 1446 1472 // 1447 1473 imageStringDown( $image, $font, $fontspaceing, $y_offset, $SORT_YLABEL, $colorblue ); 1448 1474 } 1449 1475 } 1450 //print_r( $nodes );1451 1476 1452 1477 for( $n = $x_min; $n <= $x_max; $n++ ) … … 1454 1479 for( $m = $y_min; $m <= $y_max; $m++ ) 1455 1480 { 1481 1456 1482 if( $x_min > 0 ) 1457 1483 { … … 1461 1487 { 1462 1488 $y = $y_offset + ( ($m-$y_min) * $node_width ); 1489 } 1490 1491 if( $this->isBig() ) 1492 { 1493 // Draw y(node) column number header 1494 // 1495 if(( $n == $x_min ) && ( isset($SORT_YLABEL) ) ) 1496 { 1497 $mfontspacing = 1; 1498 1499 $ylabel_x = $x - ( $fontwidth * strlen( $y_max ) ) - $mfontspacing; 1500 $ylabel_y = $y; 1501 1502 imageString( $image, $font, $ylabel_x, $ylabel_y, strval( $m ), $colorblue ); 1503 1504 $xmin_hit[$n] = true; 1505 } 1506 1507 // Draw x(rack) column number header 1508 // 1509 if(( $m == $y_min ) && ( isset($SORT_XLABEL) ) ) 1510 { 1511 $mfontspacing = 2; 1512 $xlabel_y = $y - ( $fontheight * strlen( $x_max ) ); 1513 $xlabel_x = $x + $mfontspacing; 1514 1515 imageStringDown( $image, $font, $xlabel_x, $xlabel_y, strval( $n ), $colorblue ); 1516 } 1463 1517 } 1464 1518 … … 1484 1538 if( intval( $rx ) > $n ) 1485 1539 { 1486 $m = $y_max + 1; 1487 //printf( "skipping node %s - y present & x present + rx %s > n %s\n", $rx, $n); 1540 // If x(rack) is higher than current x, skip to next x(rack) 1541 // 1542 $m = $y_max + 1; 1543 1488 1544 continue; 1489 1545 } 1490 1546 if( intval( $ry ) > $m ) 1491 1547 { 1492 //printf( "skipping node %s - y present & x present + ry %s > m %s\n", $ry, $m); 1548 // If y(node) is higher than current y, skip to next y(node) 1549 // 1493 1550 continue; 1494 1551 } … … 1505 1562 if( !in_array( $host, $filtered_nodes ) ) 1506 1563 { 1507 //printf( "setting node %s showinfo to 0 - not found in filtered_nodes", $host); 1564 // This node has been filtered out: we only want to see certain nodes 1565 // 1508 1566 $nodes[$cur_node]->setShowinfo( 0 ); 1509 1567 } … … 1521 1579 $cur_node++; 1522 1580 } 1523 if( $this->isBig() )1524 {1525 if(( $n == $x_min ) && ( isset($SORT_YLABEL) ) )1526 {1527 $mfontspacing = 1;1528 $ylabel_x = $x - ( $fontwidth * strlen( $y_max ) ) - $mfontspacing;1529 $ylabel_y = $y;1530 1531 imageString( $image, $font, $ylabel_x, $ylabel_y, strval( $m ), $colorblue );1532 }1533 if(( $m == $y_min ) && ( isset($SORT_XLABEL) ) )1534 {1535 $mfontspacing = 2;1536 $xlabel_y = $y - ( $fontheight * strlen( $x_max ) );1537 $xlabel_x = $x + $mfontspacing;1538 1539 imageStringDown( $image, $font, $xlabel_x, $xlabel_y, strval( $n ), $colorblue );1540 }1541 }1542 1543 1581 } 1544 1582 } -
trunk/web/addons/job_monarch/overview.php
r462 r463 44 44 $gnodes = $data_gatherer->getNodes(); 45 45 $cpus = $data_gatherer->getCpus(); 46 $use_fqdn = $data_gatherer->getUsingFQDN(); 46 47 47 48 function setupFilterSettings() … … 507 508 global $start, $end, $reports, $gnodes, $default_showhosts; 508 509 global $COLUMN_QUEUED, $COLUMN_REQUESTED_MEMORY, $COLUMN_NODES, $hostname; 509 global $cluster ;510 global $cluster, $use_fqdn; 510 511 511 512 $metricname = $m; … … 552 553 $view_name_nodes = array(); 553 554 555 // Is the "requested memory" column enabled in the config 556 // 554 557 if( $COLUMN_REQUESTED_MEMORY ) 555 558 { … … 557 560 } 558 561 562 // Is the "nodes hostnames" column enabled in the config 563 // 559 564 if( $COLUMN_NODES ) 560 565 { … … 562 567 } 563 568 569 // Is the "queued time" column enabled in the config 570 // 564 571 if( $COLUMN_QUEUED ) 565 572 { … … 582 589 } 583 590 591 // Running / queued amount jobs graph 592 // 584 593 if( $rjqj_host != null ) 585 594 { … … 641 650 $hostnode = $tempnode; 642 651 643 //if( substr( $hostnode, $domain_len ) != $jobs[$jobid][domain] ) 644 //{ 645 // $hostnode = $hostnode. '.'. $jobs[$jobid][domain]; 646 //} 652 if( $use_fqdn == 1) 653 { 654 if( substr( $hostnode, $domain_len ) != $jobs[$jobid][domain] ) 655 { 656 $hostnode = $hostnode. '.'. $jobs[$jobid][domain]; 657 } 658 } 647 659 648 660 if( $hostname == $hostnode ) … … 804 816 foreach( $jobs[$jobid][nodes] as $mynode ) 805 817 { 806 //$myhost_href = "./?c=".$clustername."&h=".$mynode.".".$jobs[$jobid][domain]; 818 if( $use_fqdn == 1) 819 { 820 $mynode = $mynode.".".$jobs[$jobid][domain]; 821 } 807 822 $myhost_href = "./?c=".$clustername."&h=".$mynode; 808 823 $mynodehosts[] = "<A HREF=\"".$myhost_href."\">".$mynode."</A>"; … … 978 993 foreach ( $hosts_up as $host ) 979 994 { 980 //$domain_len = 0 - strlen( $domain ); 981 982 //if( substr( $host, $domain_len ) != $domain ) 983 //{ 984 // $host = $host . '.' . $domain; 985 //} 995 $domain_len = 0 - strlen( $domain ); 996 997 if( $use_fqdn ) 998 { 999 if( substr( $host, $domain_len ) != $domain ) 1000 { 1001 $host = $host . '.' . $domain; 1002 } 1003 } 986 1004 987 1005 $cpus = $metrics[$host]["cpu_num"]["VAL"]; … … 1007 1025 } 1008 1026 } 1027 1009 1028 switch ( $sort ) 1010 1029 { -
trunk/web/addons/job_monarch/version.php
r417 r463 22 22 */ 23 23 24 $monarchversion = "0. 2.1";24 $monarchversion = "0.3SVN"; 25 25 ?>
Note: See TracChangeset
for help on using the changeset viewer.