Changeset 339
- Timestamp:
- 04/24/07 00:41:54 (16 years ago)
- Location:
- trunk/web/addons/job_monarch
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/web/addons/job_monarch/conf.php
r338 r339 1 1 <?php 2 2 3 $CLUSTER_CONFS["LISA Cluster"] = "./clusterconf/lisa-example.php"; 3 $CLUSTER_CONFS["LISA Cluster"] = "./clusterconf/lisa-example.php"; 4 $CLUSTER_CONFS["GINA Cluster"] = "./clusterconf/gina-example.php"; 5 $CLUSTER_CONFS["MATRIX Cluster"] = "./clusterconf/matrix-example.php"; 4 6 5 7 // Sort nodes in clusterimage by -
trunk/web/addons/job_monarch/libtoga.php
r337 r339 1061 1061 global $SMALL_CLUSTERIMAGE_MAXWIDTH, $SMALL_CLUSTERIMAGE_NODEWIDTH; 1062 1062 global $BIG_CLUSTERIMAGE_MAXWIDTH, $BIG_CLUSTERIMAGE_NODEWIDTH; 1063 global $CLUSTER_CONFS ;1064 1065 //global $SORTBY_HOSTNAME, $SORT_ORDER, $skan_str;1066 global $skan_str;1063 global $CLUSTER_CONFS, $confcluster; 1064 1065 global $SORTBY_HOSTNAME, $SORT_ORDER, $skan_str; 1066 //global $skan_str; 1067 1067 global $x_first, $y_first; 1068 1068 1069 1069 foreach( $CLUSTER_CONFS as $confcluster => $conffile ) 1070 1070 { 1071 if( strtolower( $this->clustername ) == $confcluster ) 1072 { 1071 //printf( "cf %s cc %s\n", $this->clustername, $confcluster); 1072 //printf( "cf %s cc %s\n", strtolower( trim($this->clustername)), trim($confcluster) ); 1073 if( strtolower( trim($this->clustername) ) == strtolower(trim($confcluster)) ) 1074 { 1075 //printf( "cf %s cc %s\n", $conffile, $confcluster); 1073 1076 include_once $conffile; 1074 1077 } 1075 1078 } 1076 1079 1077 global $SORTBY_HOSTNAME, $SORT_ORDER;1078 global $SORT_XLABEL, $SORT_YLABEL;1080 //global $SORTBY_HOSTNAME, $SORT_ORDER; 1081 //global $SORT_XLABEL, $SORT_YLABEL; 1079 1082 1083 //printf( "SORTBY_HOSTNAME %s SORT_YLABEL %s\n", $SORTBY_HOSTNAME, $SORT_YLABEL ); 1084 1080 1085 $mydatag = $this->dataget; 1081 1086 $mydatag->parseXML( $this->data ); … … 1149 1154 $y_first = 0; 1150 1155 1151 1152 if( strpos( $SORTBY_HOSTNAME, "{x}" ) < strpos( $SORTBY_HOSTNAME, "{y}" ) ) 1156 $skan_str = $SORTBY_HOSTNAME; 1157 1158 global $x_present, $y_present; 1159 $x_present = false; 1160 $y_present = false; 1161 1162 if(stripos( $SORTBY_HOSTNAME, "{x}" ) != false ) 1163 { 1164 $x_present = true; 1165 } 1166 if(stripos( $SORTBY_HOSTNAME, "{y}" ) != false ) 1167 { 1168 $y_present = true; 1169 } 1170 1171 if(( strpos( $SORTBY_HOSTNAME, "{x}" ) < strpos( $SORTBY_HOSTNAME, "{y}" ) ) && ( $x_present && $y_present )) 1153 1172 { 1154 1173 1155 1174 $x_first = 1; 1156 1175 } 1157 else 1176 else if(( strpos( $SORTBY_HOSTNAME, "{x}" ) > strpos( $SORTBY_HOSTNAME, "{y}" ) ) && ( $x_present && $y_present )) 1158 1177 { 1159 1178 $y_first = 1; 1160 1179 1161 1180 } 1162 1163 $skan_str = str_replace( "{x}", "%d", $SORTBY_HOSTNAME ); 1164 $skan_str = str_replace( "{y}", "%d", $skan_str ); 1181 else if( $x_present ) 1182 { 1183 $x_first = 1; 1184 } 1185 else if( $y_present ) 1186 { 1187 $y_first = 1; 1188 } 1189 1190 if(( $x_first ) && ( $x_present && $y_present ) ) 1191 { 1192 $skan_str = str_replace( "{x}", "%d", $skan_str ); 1193 $skan_str = str_replace( "{y}", "%d", $skan_str ); 1194 //printf("ppoep = %s\n", $skan_str); 1195 } 1196 else if( $x_present) 1197 { 1198 $skan_str = str_replace( "{x}", "%d", $skan_str ); 1199 } 1200 else if( $y_present) 1201 { 1202 $skan_str = str_replace( "{y}", "%d", $skan_str ); 1203 } 1165 1204 1166 1205 $x_min = null; … … 1171 1210 foreach( $nodes as $hostname => $node ) 1172 1211 { 1173 //$n = sscanf( $hostname, $skan_str, $i, $j ); 1174 if( $x_first ) 1212 $x = 0; 1213 $y = 0; 1214 1215 if( $x_present && $y_present ) 1175 1216 { 1176 $n = sscanf( $hostname, $skan_str, $x, $y ); 1177 } 1178 else if( $y_first ) 1217 //$n = sscanf( $hostname, $skan_str, $i, $j ); 1218 if( $x_first ) 1219 { 1220 $n = sscanf( $hostname, $skan_str, $x, $y ); 1221 } 1222 else if( $y_first ) 1223 { 1224 $n = sscanf( $hostname, $skan_str, $y, $x ); 1225 } 1226 // Remove nodes that don't match 1227 // 1228 if( $n < 2 ) 1229 { 1230 unset( $nodes[$hostname] ); 1231 } 1232 } 1233 else if( $x_present && !$y_present ) 1179 1234 { 1180 $n = sscanf( $hostname, $skan_str, $y, $x ); 1181 } 1235 $n = sscanf( $hostname, $skan_str, $x ); 1236 // Remove nodes that don't match 1237 // 1238 if( $n < 1 ) 1239 { 1240 unset( $nodes[$hostname] ); 1241 } 1242 $y = 1; 1243 } 1244 else if( $y_present && !$x_present ) 1245 { 1246 $n = sscanf( $hostname, $skan_str, $y ); 1247 // Remove nodes that don't match 1248 // 1249 if( $n < 1 ) 1250 { 1251 unset( $nodes[$hostname] ); 1252 } 1253 $x = 1; 1254 } 1255 //printf( "xfirst %s yfirst %s\n", $x_first, $y_first ); 1182 1256 1183 1257 //printf( "n %s\n", $n ); 1184 1258 1185 // Remove nodes that don't match1186 //1187 if( $n < 2 )1188 {1189 unset( $nodes[$hostname] );1190 }1191 1259 1192 1260 if( !$x_min ) … … 1226 1294 //printf( "ss %s\n", $skan_str); 1227 1295 $sorted_nodes = usort( $nodes, "cmp" ); 1296 1297 //print_r( $nodes ); 1228 1298 1229 1299 $cur_node = 0; … … 1275 1345 } 1276 1346 1277 if( $this->isBig() )1347 if( $this->isBig() && ( isset( $SORT_XLABEL ) || isset( $SORT_YLABEL ) ) ) 1278 1348 { 1279 1349 $colorblue = imageColorAllocate( $image, 0, 0, 255 ); 1280 1350 1281 imageString( $image, $font, $x_offset, $fontspaceing, $SORT_XLABEL, $colorblue ); 1282 1283 // Stupid php without imageStringDown function 1284 // 1285 imageStringDown( $image, $font, $fontspaceing, $y_offset, $SORT_YLABEL, $colorblue ); 1351 if( isset( $SORT_XLABEL ) ) 1352 { 1353 imageString( $image, $font, $x_offset, $fontspaceing, $SORT_XLABEL, $colorblue ); 1354 } 1355 1356 if( isset( $SORT_YLABEL ) ) 1357 { 1358 // Stupid php without imageStringDown function 1359 // 1360 imageStringDown( $image, $font, $fontspaceing, $y_offset, $SORT_YLABEL, $colorblue ); 1361 } 1286 1362 } 1287 1363 … … 1303 1379 $host = $nodes[$cur_node]->getHostname(); 1304 1380 1305 if( $x_ first )1381 if( $x_present && $y_present ) 1306 1382 { 1307 $nn = sscanf( $host, $skan_str, $rx, $ry ); 1383 if( $x_first ) 1384 { 1385 $nn = sscanf( $host, $skan_str, $rx, $ry ); 1386 } 1387 else if( $y_first ) 1388 { 1389 $nn = sscanf( $host, $skan_str, $ry, $rx ); 1390 } 1391 if ( $nn < 2 ) 1392 { 1393 continue; 1394 } 1395 if( ( $rx ) > $n ) 1396 { 1397 $m = $y_max + 1; 1398 continue; 1399 } 1308 1400 } 1309 else if( $ y_first )1401 else if( $x_present ) 1310 1402 { 1311 $nn = sscanf( $host, $skan_str, $r y, $rx );1403 $nn = sscanf( $host, $skan_str, $rx ); 1312 1404 } 1313 if ( $nn < 2)1405 else if( $y_present ) 1314 1406 { 1315 continue; 1316 } 1317 if( ( $rx ) > $n ) 1318 { 1319 $m = $y_max + 1; 1320 continue; 1407 $nn = sscanf( $host, $skan_str, $ry ); 1321 1408 } 1322 1409 … … 1336 1423 if( $this->isBig() ) 1337 1424 { 1338 if( $n == $x_min)1425 if(( $n == $x_min ) && ( isset($SORT_YLABEL) ) ) 1339 1426 { 1340 1427 $mfontspacing = 1; … … 1344 1431 imageString( $image, $font, $ylabel_x, $ylabel_y, strval( $m ), $colorblue ); 1345 1432 } 1346 if( $m == $y_min)1433 if(( $m == $y_min ) && ( isset($SORT_XLABEL) ) ) 1347 1434 { 1348 1435 $mfontspacing = 2; … … 1645 1732 global $skan_str; 1646 1733 global $x_first, $y_first; 1647 1734 global $x_present, $y_present; 1735 1736 //printf("ppoep = %s\n", $skan_str); 1648 1737 $a_node = $a; 1649 1738 $b_node = $b; … … 1653 1742 if( $a == $b ) return 0; 1654 1743 1655 if( $x_first ) 1744 $a_x = 0; 1745 $b_x = 0; 1746 $a_y = 0; 1747 $b_y = 0; 1748 1749 if( $x_present && $y_present ) 1656 1750 { 1657 $n = sscanf( $a, $skan_str, $a_x, $a_y ); 1658 $n = sscanf( $b, $skan_str, $b_x, $b_y ); 1659 } 1660 else if( $y_first ) 1751 if( $x_first ) 1752 { 1753 $n = sscanf( $a, $skan_str, $a_x, $a_y ); 1754 $n = sscanf( $b, $skan_str, $b_x, $b_y ); 1755 } 1756 else if( $y_first ) 1757 { 1758 $n = sscanf( $a, $skan_str, $a_y, $a_x ); 1759 $n = sscanf( $b, $skan_str, $b_y, $b_x ); 1760 } 1761 } 1762 else if( $x_present && !$y_present ) 1661 1763 { 1662 $n = sscanf( $a, $skan_str, $a_y, $a_x ); 1663 $n = sscanf( $b, $skan_str, $b_y, $b_x ); 1764 $n = sscanf( $a, $skan_str, $a_x ); 1765 $n = sscanf( $b, $skan_str, $b_x ); 1766 } 1767 else if( $y_present && !$x_present ) 1768 { 1769 $n = sscanf( $a, $skan_str, $a_y ); 1770 $n = sscanf( $b, $skan_str, $b_y ); 1664 1771 } 1665 1772 … … 1667 1774 { 1668 1775 1669 // 1 = a < b 1670 // -1 = a > b 1671 // 1672 if ($a_x == $b_x) 1776 if( $x_present && $y_present ) 1777 { 1778 // 1 = a < b 1779 // -1 = a > b 1780 // 1781 if ($a_x == $b_x) 1782 { 1783 if ($a_y < $b_y) 1784 { 1785 return 1; 1786 } 1787 else if ($a_y > $b_y) 1788 { 1789 return -1; 1790 } 1791 } 1792 else if ($a_x < $b_x) 1793 { 1794 return 1; 1795 } 1796 else if ($a_x > $b_x) 1797 { 1798 return -1; 1799 } 1800 } 1801 else if( $x_present && !$y_present ) 1802 { 1803 if ($a_x < $b_x) 1804 { 1805 return 1; 1806 } 1807 else if ($a_x > $b_x) 1808 { 1809 return -1; 1810 } 1811 } 1812 else if( $y_present && !$x_present ) 1673 1813 { 1674 1814 if ($a_y < $b_y) … … 1681 1821 } 1682 1822 } 1683 else if ($a_x < $b_x)1684 {1685 return 1;1686 }1687 else if ($a_x > $b_x)1688 {1689 return -1;1690 }1691 1823 } 1692 1824 else if ( $SORT_ORDER == "asc" ) 1693 1825 { 1694 1826 1695 // 1 = a > b 1696 // -1 = a < b 1697 // 1698 if ($a_x == $b_x) 1827 if( $x_present && $y_present ) 1828 { 1829 // 1 = a > b 1830 // -1 = a < b 1831 // 1832 if ($a_x == $b_x) 1833 { 1834 if ($a_y > $b_y) 1835 { 1836 return 1; 1837 } 1838 else if ($a_y < $b_y) 1839 { 1840 return -1; 1841 } 1842 } 1843 else if ($a_x > $b_x) 1844 { 1845 return 1; 1846 } 1847 else if ($a_x < $b_x) 1848 { 1849 return -1; 1850 } 1851 } 1852 else if( $x_present && !$y_present ) 1853 { 1854 if ($a_x > $b_x) 1855 { 1856 return 1; 1857 } 1858 else if ($a_x < $b_x) 1859 { 1860 return -1; 1861 } 1862 } 1863 else if( $y_present && !$x_present ) 1699 1864 { 1700 1865 if ($a_y > $b_y) … … 1706 1871 return -1; 1707 1872 } 1708 }1709 else if ($a_x > $b_x)1710 {1711 return 1;1712 }1713 else if ($a_x < $b_x)1714 {1715 return -1;1716 1873 } 1717 1874 }
Note: See TracChangeset
for help on using the changeset viewer.