public AMAttemptInfo(AMInfo amInfo, String jobId, String user) { this.nodeHttpAddress = ""; this.nodeId = ""; String nmHost = amInfo.getNodeManagerHost(); int nmHttpPort = amInfo.getNodeManagerHttpPort(); int nmPort = amInfo.getNodeManagerPort(); if (nmHost != null) { this.nodeHttpAddress = nmHost + ":" + nmHttpPort; NodeId nodeId = BuilderUtils.newNodeId(nmHost, nmPort); this.nodeId = nodeId.toString(); } this.id = amInfo.getAppAttemptId().getAttemptId(); this.startTime = amInfo.getStartTime(); this.containerId = ""; this.logsLink = ""; ContainerId containerId = amInfo.getContainerId(); if (containerId != null) { this.containerId = containerId.toString(); this.logsLink = join( HttpConfig.getSchemePrefix() + nodeHttpAddress, ujoin("node", "containerlogs", this.containerId, user)); } }
public AppAttemptInfo(RMAppAttempt attempt) { this.startTime = 0; this.containerId = ""; this.nodeHttpAddress = ""; this.nodeId = ""; this.logsLink = ""; if (attempt != null) { this.id = attempt.getAppAttemptId().getAttemptId(); this.startTime = attempt.getStartTime(); Container masterContainer = attempt.getMasterContainer(); if (masterContainer != null) { this.containerId = masterContainer.getId().toString(); this.nodeHttpAddress = masterContainer.getNodeHttpAddress(); this.nodeId = masterContainer.getNodeId().toString(); this.logsLink = join( HttpConfig.getSchemePrefix(), masterContainer.getNodeHttpAddress(), "/node", "/containerlogs/", ConverterUtils.toString(masterContainer.getId()), "/", attempt.getSubmissionContext().getUser()); } } }