YARN-3965. Add startup timestamp to nodemanager UI. Contributed by Hong Zhiguo

This commit is contained in:
Jason Lowe 2015-08-03 15:53:32 +00:00
parent 3cd02b9522
commit 469cfcd695
5 changed files with 19 additions and 4 deletions

View File

@ -361,6 +361,8 @@ Release 2.8.0 - UNRELEASED
YARN-3950. Add unique SHELL_ID environment variable to DistributedShell
(Robert Kanter via jlowe)
YARN-3965. Add startup timestamp to nodemanager UI (Hong Zhiguo via jlowe)
OPTIMIZATIONS
YARN-3339. TestDockerContainerExecutor should pull a single image and not

View File

@ -81,6 +81,7 @@ public class NodeManager extends CompositeService
public static final int SHUTDOWN_HOOK_PRIORITY = 30;
private static final Log LOG = LogFactory.getLog(NodeManager.class);
private static long nmStartupTime = System.currentTimeMillis();
protected final NodeManagerMetrics metrics = NodeManagerMetrics.create();
private ApplicationACLsManager aclsManager;
private NodeHealthCheckerService nodeHealthChecker;
@ -101,6 +102,10 @@ public class NodeManager extends CompositeService
super(NodeManager.class.getName());
}
public static long getNMStartupTime() {
return nmStartupTime;
}
protected NodeStatusUpdater createNodeStatusUpdater(Context context,
Dispatcher dispatcher, NodeHealthCheckerService healthChecker) {
return new NodeStatusUpdaterImpl(context, dispatcher, healthChecker,

View File

@ -73,15 +73,17 @@ public class NodePage extends NMView {
StringUtils.byteDesc(info.getTotalPmemAllocated() * BYTES_IN_MB))
._("Pmem enforcement enabled",
info.isPmemCheckEnabled())
._("Total VCores allocated for Containers",
String.valueOf(info.getTotalVCoresAllocated()))
._("Total VCores allocated for Containers",
String.valueOf(info.getTotalVCoresAllocated()))
._("NodeHealthyStatus",
info.getHealthStatus())
._("LastNodeHealthTime", new Date(
info.getLastNodeUpdateTime()))
._("NodeHealthReport",
info.getHealthReport())
._("Node Manager Version:", info.getNMBuildVersion() +
._("NodeManager started on", new Date(
info.getNMStartupTime()))
._("NodeManager Version:", info.getNMBuildVersion() +
" on " + info.getNMVersionBuiltOn())
._("Hadoop Version:", info.getHadoopBuildVersion() +
" on " + info.getHadoopVersionBuiltOn());

View File

@ -24,6 +24,7 @@ import javax.xml.bind.annotation.XmlRootElement;
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;
@ -49,6 +50,7 @@ public class NodeInfo {
protected String hadoopVersionBuiltOn;
protected String id;
protected String nodeHostName;
protected long nmStartupTime;
public NodeInfo() {
} // JAXB needs this
@ -77,6 +79,7 @@ public class NodeInfo {
this.hadoopVersion = VersionInfo.getVersion();
this.hadoopBuildVersion = VersionInfo.getBuildVersion();
this.hadoopVersionBuiltOn = VersionInfo.getDate();
this.nmStartupTime = NodeManager.getNMStartupTime();
}
public String getNodeId() {
@ -143,4 +146,7 @@ public class NodeInfo {
return this.pmemCheckEnabled;
}
public long getNMStartupTime() {
return nmStartupTime;
}
}

View File

@ -402,7 +402,7 @@ public class TestNMWebServices extends JerseyTestBase {
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", 16, info.length());
assertEquals("incorrect number of elements", 17, info.length());
verifyNodeInfoGeneric(info.getString("id"), info.getString("healthReport"),
info.getLong("totalVmemAllocatedContainersMB"),
info.getLong("totalPmemAllocatedContainersMB"),