YARN-1176. RM web services ClusterMetricsInfo total nodes doesn't include unhealthy nodes (Jonathan Eagles via tgraves)

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2@1522063 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Thomas Graves 2013-09-11 22:04:27 +00:00
parent bd257baef5
commit 3d2ac297ec
3 changed files with 20 additions and 2 deletions

View File

@ -170,6 +170,9 @@ Release 2.1.1-beta - UNRELEASED
YARN-1025. ResourceManager and NodeManager do not load native libraries on YARN-1025. ResourceManager and NodeManager do not load native libraries on
Windows. (cnauroth) Windows. (cnauroth)
YARN-1176. RM web services ClusterMetricsInfo total nodes doesn't include
unhealthy nodes (Jonathan Eagles via tgraves)
Release 2.1.0-beta - 2013-08-22 Release 2.1.0-beta - 2013-08-22
INCOMPATIBLE CHANGES INCOMPATIBLE CHANGES
@ -1294,6 +1297,9 @@ Release 0.23.10 - UNRELEASED
YARN-1101. Active nodes can be decremented below 0 (Robert Parker YARN-1101. Active nodes can be decremented below 0 (Robert Parker
via tgraves) via tgraves)
YARN-1176. RM web services ClusterMetricsInfo total nodes doesn't include
unhealthy nodes (Jonathan Eagles via tgraves)
Release 0.23.9 - 2013-07-08 Release 0.23.9 - 2013-07-08
INCOMPATIBLE CHANGES INCOMPATIBLE CHANGES

View File

@ -84,7 +84,7 @@ public class ClusterMetricsInfo {
this.decommissionedNodes = clusterMetrics.getNumDecommisionedNMs(); this.decommissionedNodes = clusterMetrics.getNumDecommisionedNMs();
this.rebootedNodes = clusterMetrics.getNumRebootedNMs(); this.rebootedNodes = clusterMetrics.getNumRebootedNMs();
this.totalNodes = activeNodes + lostNodes + decommissionedNodes this.totalNodes = activeNodes + lostNodes + decommissionedNodes
+ rebootedNodes; + rebootedNodes + unhealthyNodes;
} }
public int getAppsSubmitted() { public int getAppsSubmitted() {

View File

@ -47,6 +47,7 @@ import org.apache.hadoop.yarn.webapp.WebServicesTestUtils;
import org.codehaus.jettison.json.JSONException; import org.codehaus.jettison.json.JSONException;
import org.codehaus.jettison.json.JSONObject; import org.codehaus.jettison.json.JSONObject;
import org.junit.Before; import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test; import org.junit.Test;
import org.w3c.dom.Document; import org.w3c.dom.Document;
import org.w3c.dom.Element; import org.w3c.dom.Element;
@ -109,6 +110,16 @@ public class TestRMWebServices extends JerseyTest {
.contextPath("jersey-guice-filter").servletPath("/").build()); .contextPath("jersey-guice-filter").servletPath("/").build());
} }
@BeforeClass
public static void initClusterMetrics() {
ClusterMetrics clusterMetrics = ClusterMetrics.getMetrics();
clusterMetrics.incrDecommisionedNMs();
clusterMetrics.incrNumActiveNodes();
clusterMetrics.incrNumLostNMs();
clusterMetrics.incrNumRebootedNMs();
clusterMetrics.incrNumUnhealthyNMs();
}
@Test @Test
public void testInfoXML() throws JSONException, Exception { public void testInfoXML() throws JSONException, Exception {
WebResource r = resource(); WebResource r = resource();
@ -426,7 +437,8 @@ public class TestRMWebServices extends JerseyTest {
"totalNodes doesn't match", "totalNodes doesn't match",
clusterMetrics.getNumActiveNMs() + clusterMetrics.getNumLostNMs() clusterMetrics.getNumActiveNMs() + clusterMetrics.getNumLostNMs()
+ clusterMetrics.getNumDecommisionedNMs() + clusterMetrics.getNumDecommisionedNMs()
+ clusterMetrics.getNumRebootedNMs(), totalNodes); + clusterMetrics.getNumRebootedNMs()
+ clusterMetrics.getUnhealthyNMs(), totalNodes);
assertEquals("lostNodes doesn't match", clusterMetrics.getNumLostNMs(), assertEquals("lostNodes doesn't match", clusterMetrics.getNumLostNMs(),
lostNodes); lostNodes);
assertEquals("unhealthyNodes doesn't match", assertEquals("unhealthyNodes doesn't match",