YARN-6907. Node information page in the old web UI should report resource types. Contributed by Gergely Novák.

(cherry picked from commit 81f6e46b2f)
This commit is contained in:
Sunil G 2017-12-04 11:27:23 +05:30
parent 6f123aae41
commit f034668b91
3 changed files with 21 additions and 4 deletions

View File

@ -75,6 +75,8 @@ public class NodePage extends NMView {
info.isPmemCheckEnabled())
.__("Total VCores allocated for Containers",
String.valueOf(info.getTotalVCoresAllocated()))
.__("Resource types",
info.getResourceTypes())
.__("NodeHealthyStatus",
info.getHealthStatus())
.__("LastNodeHealthTime", new Date(

View File

@ -22,11 +22,13 @@ import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;
import org.apache.hadoop.util.StringUtils;
import org.apache.hadoop.util.VersionInfo;
import org.apache.hadoop.yarn.server.nodemanager.Context;
import org.apache.hadoop.yarn.server.nodemanager.NodeManager;
import org.apache.hadoop.yarn.server.nodemanager.ResourceView;
import org.apache.hadoop.yarn.util.YarnVersionInfo;
import org.apache.hadoop.yarn.util.resource.ResourceUtils;
@XmlRootElement
@XmlAccessorType(XmlAccessType.FIELD)
@ -41,6 +43,7 @@ public class NodeInfo {
protected boolean vmemCheckEnabled;
protected boolean pmemCheckEnabled;
protected long lastNodeUpdateTime;
protected String resourceTypes;
protected boolean nodeHealthy;
protected String nodeManagerVersion;
protected String nodeManagerBuildVersion;
@ -67,6 +70,8 @@ public class NodeInfo {
this.pmemCheckEnabled = resourceView.isPmemCheckEnabled();
this.totalVCoresAllocatedContainers = resourceView
.getVCoresAllocatedForContainers();
this.resourceTypes = StringUtils.join(", ",
ResourceUtils.getResourcesTypeInfo());
this.nodeHealthy = context.getNodeHealthStatus().getIsNodeHealthy();
this.lastNodeUpdateTime = context.getNodeHealthStatus()
.getLastHealthReportTime();
@ -146,6 +151,10 @@ public class NodeInfo {
return this.pmemCheckEnabled;
}
public String getResourceTypes() {
return this.resourceTypes;
}
public long getNMStartupTime() {
return nmStartupTime;
}

View File

@ -626,14 +626,15 @@ public class TestNMWebServices extends JerseyTestBase {
WebServicesTestUtils.getXmlString(element,
"nodeManagerVersionBuiltOn"), WebServicesTestUtils.getXmlString(
element, "nodeManagerBuildVersion"),
WebServicesTestUtils.getXmlString(element, "nodeManagerVersion"));
WebServicesTestUtils.getXmlString(element, "nodeManagerVersion"),
WebServicesTestUtils.getXmlString(element, "resourceTypes"));
}
}
public void verifyNodeInfo(JSONObject json) throws JSONException, Exception {
assertEquals("incorrect number of elements", 1, json.length());
JSONObject info = json.getJSONObject("nodeInfo");
assertEquals("incorrect number of elements", 17, info.length());
assertEquals("incorrect number of elements", 18, info.length());
verifyNodeInfoGeneric(info.getString("id"), info.getString("healthReport"),
info.getLong("totalVmemAllocatedContainersMB"),
info.getLong("totalPmemAllocatedContainersMB"),
@ -645,7 +646,9 @@ public class TestNMWebServices extends JerseyTestBase {
info.getString("hadoopBuildVersion"), info.getString("hadoopVersion"),
info.getString("nodeManagerVersionBuiltOn"),
info.getString("nodeManagerBuildVersion"),
info.getString("nodeManagerVersion"));
info.getString("nodeManagerVersion"),
info.getString("resourceTypes")
);
}
@ -656,7 +659,8 @@ public class TestNMWebServices extends JerseyTestBase {
long lastNodeUpdateTime, Boolean nodeHealthy, String nodeHostName,
String hadoopVersionBuiltOn, String hadoopBuildVersion,
String hadoopVersion, String resourceManagerVersionBuiltOn,
String resourceManagerBuildVersion, String resourceManagerVersion) {
String resourceManagerBuildVersion, String resourceManagerVersion,
String resourceTypes) {
WebServicesTestUtils.checkStringMatch("id", "testhost.foo.com:8042", id);
WebServicesTestUtils.checkStringMatch("healthReport", "Healthy",
@ -688,6 +692,8 @@ public class TestNMWebServices extends JerseyTestBase {
YarnVersionInfo.getBuildVersion(), resourceManagerBuildVersion);
WebServicesTestUtils.checkStringMatch("resourceManagerVersion",
YarnVersionInfo.getVersion(), resourceManagerVersion);
assertEquals("memory-mb (unit=Mi), vcores", resourceTypes);
}
private String getLogContext(String fullMessage) {