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:
parent
6f123aae41
commit
f034668b91
|
@ -75,6 +75,8 @@ public class NodePage extends NMView {
|
||||||
info.isPmemCheckEnabled())
|
info.isPmemCheckEnabled())
|
||||||
.__("Total VCores allocated for Containers",
|
.__("Total VCores allocated for Containers",
|
||||||
String.valueOf(info.getTotalVCoresAllocated()))
|
String.valueOf(info.getTotalVCoresAllocated()))
|
||||||
|
.__("Resource types",
|
||||||
|
info.getResourceTypes())
|
||||||
.__("NodeHealthyStatus",
|
.__("NodeHealthyStatus",
|
||||||
info.getHealthStatus())
|
info.getHealthStatus())
|
||||||
.__("LastNodeHealthTime", new Date(
|
.__("LastNodeHealthTime", new Date(
|
||||||
|
|
|
@ -22,11 +22,13 @@ import javax.xml.bind.annotation.XmlAccessType;
|
||||||
import javax.xml.bind.annotation.XmlAccessorType;
|
import javax.xml.bind.annotation.XmlAccessorType;
|
||||||
import javax.xml.bind.annotation.XmlRootElement;
|
import javax.xml.bind.annotation.XmlRootElement;
|
||||||
|
|
||||||
|
import org.apache.hadoop.util.StringUtils;
|
||||||
import org.apache.hadoop.util.VersionInfo;
|
import org.apache.hadoop.util.VersionInfo;
|
||||||
import org.apache.hadoop.yarn.server.nodemanager.Context;
|
import org.apache.hadoop.yarn.server.nodemanager.Context;
|
||||||
import org.apache.hadoop.yarn.server.nodemanager.NodeManager;
|
import org.apache.hadoop.yarn.server.nodemanager.NodeManager;
|
||||||
import org.apache.hadoop.yarn.server.nodemanager.ResourceView;
|
import org.apache.hadoop.yarn.server.nodemanager.ResourceView;
|
||||||
import org.apache.hadoop.yarn.util.YarnVersionInfo;
|
import org.apache.hadoop.yarn.util.YarnVersionInfo;
|
||||||
|
import org.apache.hadoop.yarn.util.resource.ResourceUtils;
|
||||||
|
|
||||||
@XmlRootElement
|
@XmlRootElement
|
||||||
@XmlAccessorType(XmlAccessType.FIELD)
|
@XmlAccessorType(XmlAccessType.FIELD)
|
||||||
|
@ -41,6 +43,7 @@ public class NodeInfo {
|
||||||
protected boolean vmemCheckEnabled;
|
protected boolean vmemCheckEnabled;
|
||||||
protected boolean pmemCheckEnabled;
|
protected boolean pmemCheckEnabled;
|
||||||
protected long lastNodeUpdateTime;
|
protected long lastNodeUpdateTime;
|
||||||
|
protected String resourceTypes;
|
||||||
protected boolean nodeHealthy;
|
protected boolean nodeHealthy;
|
||||||
protected String nodeManagerVersion;
|
protected String nodeManagerVersion;
|
||||||
protected String nodeManagerBuildVersion;
|
protected String nodeManagerBuildVersion;
|
||||||
|
@ -67,6 +70,8 @@ public class NodeInfo {
|
||||||
this.pmemCheckEnabled = resourceView.isPmemCheckEnabled();
|
this.pmemCheckEnabled = resourceView.isPmemCheckEnabled();
|
||||||
this.totalVCoresAllocatedContainers = resourceView
|
this.totalVCoresAllocatedContainers = resourceView
|
||||||
.getVCoresAllocatedForContainers();
|
.getVCoresAllocatedForContainers();
|
||||||
|
this.resourceTypes = StringUtils.join(", ",
|
||||||
|
ResourceUtils.getResourcesTypeInfo());
|
||||||
this.nodeHealthy = context.getNodeHealthStatus().getIsNodeHealthy();
|
this.nodeHealthy = context.getNodeHealthStatus().getIsNodeHealthy();
|
||||||
this.lastNodeUpdateTime = context.getNodeHealthStatus()
|
this.lastNodeUpdateTime = context.getNodeHealthStatus()
|
||||||
.getLastHealthReportTime();
|
.getLastHealthReportTime();
|
||||||
|
@ -146,6 +151,10 @@ public class NodeInfo {
|
||||||
return this.pmemCheckEnabled;
|
return this.pmemCheckEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getResourceTypes() {
|
||||||
|
return this.resourceTypes;
|
||||||
|
}
|
||||||
|
|
||||||
public long getNMStartupTime() {
|
public long getNMStartupTime() {
|
||||||
return nmStartupTime;
|
return nmStartupTime;
|
||||||
}
|
}
|
||||||
|
|
|
@ -626,14 +626,15 @@ public class TestNMWebServices extends JerseyTestBase {
|
||||||
WebServicesTestUtils.getXmlString(element,
|
WebServicesTestUtils.getXmlString(element,
|
||||||
"nodeManagerVersionBuiltOn"), WebServicesTestUtils.getXmlString(
|
"nodeManagerVersionBuiltOn"), WebServicesTestUtils.getXmlString(
|
||||||
element, "nodeManagerBuildVersion"),
|
element, "nodeManagerBuildVersion"),
|
||||||
WebServicesTestUtils.getXmlString(element, "nodeManagerVersion"));
|
WebServicesTestUtils.getXmlString(element, "nodeManagerVersion"),
|
||||||
|
WebServicesTestUtils.getXmlString(element, "resourceTypes"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void verifyNodeInfo(JSONObject json) throws JSONException, Exception {
|
public void verifyNodeInfo(JSONObject json) throws JSONException, Exception {
|
||||||
assertEquals("incorrect number of elements", 1, json.length());
|
assertEquals("incorrect number of elements", 1, json.length());
|
||||||
JSONObject info = json.getJSONObject("nodeInfo");
|
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"),
|
verifyNodeInfoGeneric(info.getString("id"), info.getString("healthReport"),
|
||||||
info.getLong("totalVmemAllocatedContainersMB"),
|
info.getLong("totalVmemAllocatedContainersMB"),
|
||||||
info.getLong("totalPmemAllocatedContainersMB"),
|
info.getLong("totalPmemAllocatedContainersMB"),
|
||||||
|
@ -645,7 +646,9 @@ public class TestNMWebServices extends JerseyTestBase {
|
||||||
info.getString("hadoopBuildVersion"), info.getString("hadoopVersion"),
|
info.getString("hadoopBuildVersion"), info.getString("hadoopVersion"),
|
||||||
info.getString("nodeManagerVersionBuiltOn"),
|
info.getString("nodeManagerVersionBuiltOn"),
|
||||||
info.getString("nodeManagerBuildVersion"),
|
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,
|
long lastNodeUpdateTime, Boolean nodeHealthy, String nodeHostName,
|
||||||
String hadoopVersionBuiltOn, String hadoopBuildVersion,
|
String hadoopVersionBuiltOn, String hadoopBuildVersion,
|
||||||
String hadoopVersion, String resourceManagerVersionBuiltOn,
|
String hadoopVersion, String resourceManagerVersionBuiltOn,
|
||||||
String resourceManagerBuildVersion, String resourceManagerVersion) {
|
String resourceManagerBuildVersion, String resourceManagerVersion,
|
||||||
|
String resourceTypes) {
|
||||||
|
|
||||||
WebServicesTestUtils.checkStringMatch("id", "testhost.foo.com:8042", id);
|
WebServicesTestUtils.checkStringMatch("id", "testhost.foo.com:8042", id);
|
||||||
WebServicesTestUtils.checkStringMatch("healthReport", "Healthy",
|
WebServicesTestUtils.checkStringMatch("healthReport", "Healthy",
|
||||||
|
@ -688,6 +692,8 @@ public class TestNMWebServices extends JerseyTestBase {
|
||||||
YarnVersionInfo.getBuildVersion(), resourceManagerBuildVersion);
|
YarnVersionInfo.getBuildVersion(), resourceManagerBuildVersion);
|
||||||
WebServicesTestUtils.checkStringMatch("resourceManagerVersion",
|
WebServicesTestUtils.checkStringMatch("resourceManagerVersion",
|
||||||
YarnVersionInfo.getVersion(), resourceManagerVersion);
|
YarnVersionInfo.getVersion(), resourceManagerVersion);
|
||||||
|
|
||||||
|
assertEquals("memory-mb (unit=Mi), vcores", resourceTypes);
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getLogContext(String fullMessage) {
|
private String getLogContext(String fullMessage) {
|
||||||
|
|
Loading…
Reference in New Issue