diff -u web/addons/job_monarch/index.php /var/www/html/ganglia/addons/job_monarch/index.php
old
|
new
|
|
119 | 119 | $header = "header"; |
120 | 120 | |
121 | 121 | # Maintain our path through the grid tree. |
122 | | $me = $self . "@" . $grid[$self][AUTHORITY]; |
| 122 | $me = $self . "@" . $grid[$self]['AUTHORITY']; |
123 | 123 | |
124 | 124 | $gridstack = array(); |
125 | 125 | $gridstack[] = $me; |
diff -u web/addons/job_monarch/libtoga.php /var/www/html/ganglia/addons/job_monarch/libtoga.php
old
|
new
|
|
235 | 235 | $count_query = "SELECT " . $count_result_idname . " " . $query; |
236 | 236 | |
237 | 237 | $count_result = $this->queryDbase( $count_query ); |
238 | | $this->resultcount = (int) $count_result[0][count]; |
| 238 | $this->resultcount = (int) $count_result[0]['count']; |
239 | 239 | |
240 | 240 | $select_query = "SELECT " . $select_result_idname . " " . $query . " ORDER BY job_id DESC LIMIT " . $SEARCH_RESULT_LIMIT; |
241 | 241 | } |
… |
… |
|
606 | 606 | { |
607 | 607 | foreach( $this->jobs as $jobid=>$jobattrs ) |
608 | 608 | { |
609 | | $nodes = count( $jobattrs[nodes] ); |
610 | | $ppn = (int) $jobattrs[ppn] ? $jobattrs[ppn] : 1; |
| 609 | $nodes = count( $jobattrs['nodes'] ); |
| 610 | $ppn = (int) $jobattrs['ppn'] ? $jobattrs['ppn'] : 1; |
611 | 611 | $mycpus = $nodes * $ppn; |
612 | 612 | |
613 | 613 | $cpus = $cpus + $mycpus; |
… |
… |
|
678 | 678 | $jobs = $this->jobs; |
679 | 679 | $nodes = $this->nodes; |
680 | 680 | |
681 | | if ( $attrs[TN] ) |
| 681 | if ( $attrs['TN'] ) |
682 | 682 | { |
683 | 683 | // Ignore dead metrics. Detect and mask failures. |
684 | | if ( $attrs[TN] > $attrs[TMAX] * 4 ) |
| 684 | if ( $attrs['TN'] > $attrs['TMAX'] * 4 ) |
685 | 685 | { |
686 | 686 | return; |
687 | 687 | } |
… |
… |
|
691 | 691 | |
692 | 692 | if( $name == 'CLUSTER' ) |
693 | 693 | { |
694 | | $this->proc_cluster = $attrs[NAME]; |
| 694 | $this->proc_cluster = $attrs['NAME']; |
695 | 695 | } |
696 | 696 | else if( $name == 'HOST' and $this->proc_cluster == $this->clustername) |
697 | 697 | { |
698 | | $hostname = $attrs[NAME]; |
| 698 | $hostname = $attrs['NAME']; |
699 | 699 | |
700 | | $location = $attrs[LOCATION]; |
| 700 | $location = $attrs['LOCATION']; |
701 | 701 | |
702 | 702 | if( !isset( $nodes[$hostname] ) ) |
703 | 703 | { |
704 | 704 | $nodes[$hostname] = new NodeImage( $this->proc_cluster, $hostname ); |
705 | 705 | } |
706 | 706 | } |
707 | | else if( $name == 'METRIC' and strstr( $attrs[NAME], 'MONARCH' ) and $this->proc_cluster == $this->clustername ) |
| 707 | else if( $name == 'METRIC' and strstr( $attrs['NAME'], 'MONARCH' ) and $this->proc_cluster == $this->clustername ) |
708 | 708 | { |
709 | | if( strstr( $attrs[NAME], 'MONARCH-HEARTBEAT' ) ) |
| 709 | if( strstr( $attrs['NAME'], 'MONARCH-HEARTBEAT' ) ) |
710 | 710 | { |
711 | | $this->heartbeat['time'] = $attrs[VAL]; |
| 711 | $this->heartbeat['time'] = $attrs['VAL']; |
712 | 712 | } |
713 | | else if( strstr( $attrs[NAME], 'MONARCH-DOWN' ) ) |
| 713 | else if( strstr( $attrs['NAME'], 'MONARCH-DOWN' ) ) |
714 | 714 | { |
715 | | $fields = explode( ' ', $attrs[VAL] ); |
| 715 | $fields = explode( ' ', $attrs['VAL'] ); |
716 | 716 | |
717 | 717 | $nodes_down = array(); |
718 | 718 | $down_domain = null; |
… |
… |
|
746 | 746 | } |
747 | 747 | } |
748 | 748 | } |
749 | | else if( strstr( $attrs[NAME], 'MONARCH-OFFLINE' ) ) |
| 749 | else if( strstr( $attrs['NAME'], 'MONARCH-OFFLINE' ) ) |
750 | 750 | { |
751 | | $fields = explode( ' ', $attrs[VAL] ); |
| 751 | $fields = explode( ' ', $attrs['VAL'] ); |
752 | 752 | |
753 | 753 | $nodes_offline = array(); |
754 | 754 | $offline_domain = null; |
… |
… |
|
782 | 782 | } |
783 | 783 | } |
784 | 784 | } |
785 | | else if( strstr( $attrs[NAME], 'MONARCH-JOB' ) ) |
| 785 | else if( strstr( $attrs['NAME'], 'MONARCH-JOB' ) ) |
786 | 786 | { |
787 | | sscanf( $attrs[NAME], 'MONARCH-JOB-%d-%d', $jobid, $monincr ); |
| 787 | sscanf( $attrs['NAME'], 'MONARCH-JOB-%d-%d', $jobid, $monincr ); |
788 | 788 | |
789 | 789 | if( !isset( $jobs[$jobid] ) ) |
790 | 790 | { |
791 | 791 | $jobs[$jobid] = array(); |
792 | 792 | } |
793 | 793 | |
794 | | $fields = explode( ' ', $attrs[VAL] ); |
| 794 | $fields = explode( ' ', $attrs['VAL'] ); |
795 | 795 | |
796 | 796 | foreach( $fields as $f ) |
797 | 797 | { |
… |
… |
|
802 | 802 | |
803 | 803 | if( $toganame == 'nodes' ) |
804 | 804 | { |
805 | | if( $jobs[$jobid][status] == 'R' ) |
| 805 | if( $jobs[$jobid]['status'] == 'R' ) |
806 | 806 | { |
807 | 807 | if( !isset( $jobs[$jobid][$toganame] ) ) |
808 | 808 | { |
… |
… |
|
820 | 820 | } |
821 | 821 | |
822 | 822 | } |
823 | | else if( $jobs[$jobid][status] == 'Q' ) |
| 823 | else if( $jobs[$jobid]['status'] == 'Q' ) |
824 | 824 | { |
825 | 825 | $jobs[$jobid][$toganame] = $togavalue; |
826 | 826 | } |
… |
… |
|
831 | 831 | } |
832 | 832 | } |
833 | 833 | |
834 | | if( isset( $jobs[$jobid][nodes] ) ) |
| 834 | if( isset( $jobs[$jobid]['nodes'] ) ) |
835 | 835 | { |
836 | | $nr_nodes = count( $jobs[$jobid][nodes] ); |
| 836 | $nr_nodes = count( $jobs[$jobid]['nodes'] ); |
837 | 837 | |
838 | | if( $jobs[$jobid][status] == 'R' ) |
| 838 | if( $jobs[$jobid]['status'] == 'R' ) |
839 | 839 | { |
840 | 840 | |
841 | | if( isset( $jobs[$jobid][domain] ) ) |
| 841 | if( isset( $jobs[$jobid]['domain'] ) ) |
842 | 842 | { |
843 | | $domain = $jobs[$jobid][domain]; |
| 843 | $domain = $jobs[$jobid]['domain']; |
844 | 844 | $domain_len = 0 - strlen( $domain ); |
845 | 845 | |
846 | 846 | // Let's see if Ganglia use's FQDN or short hostnames |
… |
… |
|
859 | 859 | $this->fqdn = 0; |
860 | 860 | } |
861 | 861 | |
862 | | foreach( $jobs[$jobid][nodes] as $node ) |
| 862 | foreach( $jobs[$jobid]['nodes'] as $node ) |
863 | 863 | { |
864 | 864 | |
865 | 865 | // Only add domain name to the hostname if Ganglia is doing that too |
866 | 866 | // |
867 | | if( $this->fqdn && isset( $jobs[$jobid][domain] ) ) |
| 867 | if( $this->fqdn && isset( $jobs[$jobid]['domain'] ) ) |
868 | 868 | { |
869 | 869 | if( substr( $node, $domain_len ) != $domain ) |
870 | 870 | { |
… |
… |
|
890 | 890 | |
891 | 891 | if( !$my_node->hasJob( $jobid ) ) |
892 | 892 | { |
893 | | if( isset( $jobs[$jobid][ppn] ) ) |
| 893 | if( isset( $jobs[$jobid]['ppn'] ) ) |
894 | 894 | { |
895 | | $my_node->addJob( $jobid, ((int) $jobs[$jobid][ppn]) ); |
| 895 | $my_node->addJob( $jobid, ((int) $jobs[$jobid]['ppn']) ); |
896 | 896 | } |
897 | 897 | else |
898 | 898 | { |
… |
… |
|
982 | 982 | { |
983 | 983 | printf( "job %s\n", $jobid ); |
984 | 984 | |
985 | | if( isset( $job[nodes] ) ) |
| 985 | if( isset( $job['nodes'] ) ) |
986 | 986 | { |
987 | | foreach( $job[nodes] as $node ) |
| 987 | foreach( $job['nodes'] as $node ) |
988 | 988 | { |
989 | 989 | $mynode = $this->nodes[$node]; |
990 | 990 | $hostname = $mynode->getHostname(); |
… |
… |
|
1265 | 1265 | { |
1266 | 1266 | global $metrics; |
1267 | 1267 | |
1268 | | $cpus = $metrics[$this->hostname][cpu_num][VAL]; |
| 1268 | $cpus = $metrics[$this->hostname]['cpu_num']['VAL']; |
1269 | 1269 | |
1270 | 1270 | if (!$cpus) |
1271 | 1271 | { |
… |
… |
|
1279 | 1279 | { |
1280 | 1280 | global $metrics; |
1281 | 1281 | |
1282 | | $load_one = $metrics[$this->hostname][load_one][VAL]; |
| 1282 | $load_one = $metrics[$this->hostname]['load_one']['VAL']; |
1283 | 1283 | $load = ((float) $load_one)/$this->cpus; |
1284 | 1284 | |
1285 | 1285 | return $load; |
… |
… |
|
2008 | 2008 | { |
2009 | 2009 | if( $headername == 'nodes' ) |
2010 | 2010 | { |
2011 | | $attrval = strval( count( $jobinfo[nodes] ) ); |
| 2011 | $attrval = strval( count( $jobinfo['nodes'] ) ); |
2012 | 2012 | } |
2013 | 2013 | else if( $headername == 'cpus' ) |
2014 | 2014 | { |
2015 | | if( !isset( $jobinfo[ppn] ) ) |
| 2015 | if( !isset( $jobinfo['ppn'] ) ) |
2016 | 2016 | { |
2017 | | $jobinfo[ppn] = 1; |
| 2017 | $jobinfo['ppn'] = 1; |
2018 | 2018 | } |
2019 | 2019 | |
2020 | | $attrval = strval( count( $jobinfo[nodes] ) * intval( $jobinfo[ppn] ) ); |
| 2020 | $attrval = strval( count( $jobinfo['nodes'] ) * intval( $jobinfo['ppn'] ) ); |
2021 | 2021 | } |
2022 | 2022 | else if( $headername == 'runningtime' ) |
2023 | 2023 | { |
2024 | | $attrval = makeTime( intval( $jobinfo[reported] ) - intval( $jobinfo[start_timestamp] ) ); |
| 2024 | $attrval = makeTime( intval( $jobinfo['reported'] ) - intval( $jobinfo[start_timestamp] ) ); |
2025 | 2025 | } |
2026 | 2026 | else |
2027 | 2027 | { |
… |
… |
|
2046 | 2046 | $jobid = $this->njobs[$n]; |
2047 | 2047 | $jobinfo = $dg->getJob( $jobid ); |
2048 | 2048 | |
2049 | | if( !isset( $this->headerstrlen[id] ) ) |
| 2049 | if( !isset( $this->headerstrlen['id'] ) ) |
2050 | 2050 | { |
2051 | | $this->headerstrlen[id] = strlen( strval( $jobid ) ); |
| 2051 | $this->headerstrlen['id'] = strlen( strval( $jobid ) ); |
2052 | 2052 | } |
2053 | | else if( strlen( strval( $jobid ) ) > $this->headerstrlen[id] ) |
| 2053 | else if( strlen( strval( $jobid ) ) > $this->headerstrlen['id'] ) |
2054 | 2054 | { |
2055 | | $this->headerstrlen[id] = strlen( strval( $jobid ) ); |
| 2055 | $this->headerstrlen['id'] = strlen( strval( $jobid ) ); |
2056 | 2056 | } |
2057 | 2057 | |
2058 | | if( !isset( $this->headerstrlen[owner] ) ) |
| 2058 | if( !isset( $this->headerstrlen['owner'] ) ) |
2059 | 2059 | { |
2060 | | $this->headerstrlen[owner] = strlen( strval( $jobinfo[owner] ) ); |
| 2060 | $this->headerstrlen['owner'] = strlen( strval( $jobinfo['owner'] ) ); |
2061 | 2061 | } |
2062 | | else if( strlen( strval( $jobinfo[owner] ) ) > $this->headerstrlen[owner] ) |
| 2062 | else if( strlen( strval( $jobinfo['owner'] ) ) > $this->headerstrlen['owner'] ) |
2063 | 2063 | { |
2064 | | $this->headerstrlen[owner] = strlen( strval( $jobinfo[owner] ) ); |
| 2064 | $this->headerstrlen['owner'] = strlen( strval( $jobinfo['owner'] ) ); |
2065 | 2065 | } |
2066 | 2066 | |
2067 | | if( !isset( $this->headerstrlen[queue] ) ) |
| 2067 | if( !isset( $this->headerstrlen['queue'] ) ) |
2068 | 2068 | { |
2069 | | $this->headerstrlen[queue] = strlen( strval( $jobinfo[queue] ) ); |
| 2069 | $this->headerstrlen['queue'] = strlen( strval( $jobinfo['queue'] ) ); |
2070 | 2070 | } |
2071 | | else if( strlen( strval( $jobinfo[queue] ) ) > $this->headerstrlen[queue] ) |
| 2071 | else if( strlen( strval( $jobinfo['queue'] ) ) > $this->headerstrlen['queue'] ) |
2072 | 2072 | { |
2073 | | $this->headerstrlen[queue] = strlen( strval( $jobinfo[queue] ) ); |
| 2073 | $this->headerstrlen['queue'] = strlen( strval( $jobinfo['queue'] ) ); |
2074 | 2074 | } |
2075 | 2075 | |
2076 | | if( !isset( $jobinfo[ppn] ) ) |
| 2076 | if( !isset( $jobinfo['ppn'] ) ) |
2077 | 2077 | { |
2078 | | $jobinfo[ppn] = 1; |
| 2078 | $jobinfo['ppn'] = 1; |
2079 | 2079 | } |
2080 | 2080 | |
2081 | | $cpus = count( $jobinfo[nodes] ) * intval( $jobinfo[ppn] ); |
| 2081 | $cpus = count( $jobinfo['nodes'] ) * intval( $jobinfo['ppn'] ); |
2082 | 2082 | |
2083 | | if( !isset( $this->headerstrlen[cpus] ) ) |
| 2083 | if( !isset( $this->headerstrlen['cpus'] ) ) |
2084 | 2084 | { |
2085 | | $this->headerstrlen[cpus] = strlen( strval( $cpus ) ); |
| 2085 | $this->headerstrlen['cpus'] = strlen( strval( $cpus ) ); |
2086 | 2086 | } |
2087 | | else if( strlen( strval( $cpus ) ) > $this->headerstrlen[cpus] ) |
| 2087 | else if( strlen( strval( $cpus ) ) > $this->headerstrlen['cpus'] ) |
2088 | 2088 | { |
2089 | | $this->headerstrlen[cpus] = strlen( strval( $cpus ) ); |
| 2089 | $this->headerstrlen['cpus'] = strlen( strval( $cpus ) ); |
2090 | 2090 | } |
2091 | 2091 | |
2092 | | $nodes = count( $jobinfo[nodes] ); |
| 2092 | $nodes = count( $jobinfo['nodes'] ); |
2093 | 2093 | |
2094 | | if( !isset( $this->headerstrlen[nodes] ) ) |
| 2094 | if( !isset( $this->headerstrlen['nodes'] ) ) |
2095 | 2095 | { |
2096 | | $this->headerstrlen[nodes] = strlen( strval( $nodes ) ); |
| 2096 | $this->headerstrlen['nodes'] = strlen( strval( $nodes ) ); |
2097 | 2097 | } |
2098 | | else if( strlen( strval( $nodes) ) > $this->headerstrlen[nodes] ) |
| 2098 | else if( strlen( strval( $nodes) ) > $this->headerstrlen['nodes'] ) |
2099 | 2099 | { |
2100 | | $this->headerstrlen[nodes] = strlen( strval( $nodes ) ); |
| 2100 | $this->headerstrlen['nodes'] = strlen( strval( $nodes ) ); |
2101 | 2101 | } |
2102 | 2102 | |
2103 | | $runningtime = makeTime( intval( $jobinfo[reported] ) - intval( $jobinfo[start_timestamp] ) ); |
| 2103 | $runningtime = makeTime( intval( $jobinfo['reported'] ) - intval( $jobinfo[start_timestamp] ) ); |
2104 | 2104 | |
2105 | | if( !isset( $this->headerstrlen[runningtime] ) ) |
| 2105 | if( !isset( $this->headerstrlen['runningtime'] ) ) |
2106 | 2106 | { |
2107 | | $this->headerstrlen[runningtime] = strlen( strval( $runningtime) ); |
| 2107 | $this->headerstrlen['runningtime'] = strlen( strval( $runningtime) ); |
2108 | 2108 | } |
2109 | | else if( strlen( strval( $runningtime) ) > $this->headerstrlen[runningtime] ) |
| 2109 | else if( strlen( strval( $runningtime) ) > $this->headerstrlen['runningtime'] ) |
2110 | 2110 | { |
2111 | | $this->headerstrlen[runningtime] = strlen( strval( $runningtime) ); |
| 2111 | $this->headerstrlen['runningtime'] = strlen( strval( $runningtime) ); |
2112 | 2112 | } |
2113 | 2113 | |
2114 | | if( !isset( $this->headerstrlen[name] ) ) |
| 2114 | if( !isset( $this->headerstrlen['name'] ) ) |
2115 | 2115 | { |
2116 | | $this->headerstrlen[name] = strlen( strval( $jobinfo[name] ) ); |
| 2116 | $this->headerstrlen['name'] = strlen( strval( $jobinfo['name'] ) ); |
2117 | 2117 | } |
2118 | | else if( strlen( strval( $jobinfo[name] ) ) > $this->headerstrlen[name] ) |
| 2118 | else if( strlen( strval( $jobinfo['name'] ) ) > $this->headerstrlen['name'] ) |
2119 | 2119 | { |
2120 | | $this->headerstrlen[name] = strlen( strval( $jobinfo[name] ) ); |
| 2120 | $this->headerstrlen['name'] = strlen( strval( $jobinfo['name'] ) ); |
2121 | 2121 | } |
2122 | 2122 | } |
2123 | 2123 | |
diff -u web/addons/job_monarch/overview.php /var/www/html/ganglia/addons/job_monarch/overview.php
old
|
new
|
|
257 | 257 | { |
258 | 258 | $myjobs = $node->getJobs(); |
259 | 259 | $myhost = $node->getHostname(); |
260 | | $node_cpus = $metrics[$myhost]["cpu_num"][VAL]; |
| 260 | $node_cpus = $metrics[$myhost]['cpu_num']['VAL']; |
261 | 261 | $job_cpu = 0; |
262 | 262 | |
263 | 263 | foreach( $myjobs as $myjob ) |
264 | 264 | { |
265 | | $job_cpu += (int) $jobs[$myjob][ppn] ? $jobs[$myjob][ppn] : 1; |
| 265 | $job_cpu += (int) $jobs[$myjob]['ppn'] ? $jobs[$myjob]['ppn'] : 1; |
266 | 266 | } |
267 | 267 | |
268 | 268 | $node_freecpu = $node_cpus - $job_cpu; |
… |
… |
|
291 | 291 | $node_jobs = $node->getJobs(); |
292 | 292 | $nr_node_jobs = count( $node_jobs ); |
293 | 293 | $myhost = $node->getHostname(); |
294 | | $node_cpus = $metrics[$myhost]["cpu_num"][VAL]; |
| 294 | $node_cpus = $metrics[$myhost]['cpu_num']['VAL']; |
295 | 295 | |
296 | 296 | foreach( $node_jobs as $myjob ) |
297 | 297 | { |
298 | | $job_cpu = (int) $jobs[$myjob][ppn] ? $jobs[$myjob][ppn] : 1; |
| 298 | $job_cpu = (int) $jobs[$myjob]['ppn'] ? $jobs[$myjob]['ppn'] : 1; |
299 | 299 | |
300 | 300 | // Determine the weight of this job |
301 | 301 | // - what percentage of the cpus is in use by this job |
… |
… |
|
316 | 316 | } |
317 | 317 | else if( $piefilter == 'user' ) |
318 | 318 | { |
319 | | if( $jobs[$myjob][owner] != $filter[$piefilter] ) |
| 319 | if( $jobs[$myjob]['owner'] != $filter[$piefilter] ) |
320 | 320 | { |
321 | 321 | $countjob = 0; |
322 | 322 | } |