MAPREDUCE-6701. application master log can not be available when clicking jobhistory's am logs link. Contributed by Haibo Chen

(cherry picked from commit 12fa4ec141)
This commit is contained in:
Jason Lowe 2016-05-17 14:54:13 +00:00
parent 48be0ff67a
commit 51e06c085f
3 changed files with 9 additions and 7 deletions

View File

@ -142,7 +142,7 @@ public class HsJobBlock extends HtmlBlock {
td().a(".nodelink", url(MRWebAppUtil.getYARNWebappScheme(), td().a(".nodelink", url(MRWebAppUtil.getYARNWebappScheme(),
attempt.getNodeHttpAddress()), attempt.getNodeHttpAddress()),
attempt.getNodeHttpAddress())._(). attempt.getNodeHttpAddress())._().
td().a(".logslink", url(attempt.getShortLogsLink()), td().a(".logslink", url(attempt.getLogsLink()),
"logs")._(). "logs")._().
_(); _();
} }

View File

@ -68,7 +68,7 @@ public AMAttemptInfo(AMInfo amInfo, String jobId, String user, String host,
if (containerId != null) { if (containerId != null) {
this.containerId = containerId.toString(); this.containerId = containerId.toString();
this.logsLink = join(host, pathPrefix, this.logsLink = join(host, pathPrefix,
ujoin("logs", this.nodeHttpAddress, this.containerId, jobId, user)); ujoin("logs", this.nodeId, this.containerId, jobId, user));
this.shortLogsLink = ujoin("logs", this.nodeHttpAddress, this.containerId, this.shortLogsLink = ujoin("logs", this.nodeHttpAddress, this.containerId,
jobId, user); jobId, user);
} }

View File

@ -766,6 +766,7 @@ public void verifyHsJobAttempts(JSONObject info, Job job)
for (int i = 0; i < attempts.length(); i++) { for (int i = 0; i < attempts.length(); i++) {
JSONObject attempt = attempts.getJSONObject(i); JSONObject attempt = attempts.getJSONObject(i);
verifyHsJobAttemptsGeneric(job, attempt.getString("nodeHttpAddress"), verifyHsJobAttemptsGeneric(job, attempt.getString("nodeHttpAddress"),
attempt.getString("nodeId"),
attempt.getInt("id"), attempt.getInt("id"),
attempt.getLong("startTime"), attempt.getString("containerId"), attempt.getLong("startTime"), attempt.getString("containerId"),
attempt.getString("logsLink")); attempt.getString("logsLink"));
@ -779,6 +780,7 @@ public void verifyHsJobAttemptsXML(NodeList nodes, Job job) {
Element element = (Element) nodes.item(i); Element element = (Element) nodes.item(i);
verifyHsJobAttemptsGeneric(job, verifyHsJobAttemptsGeneric(job,
WebServicesTestUtils.getXmlString(element, "nodeHttpAddress"), WebServicesTestUtils.getXmlString(element, "nodeHttpAddress"),
WebServicesTestUtils.getXmlString(element, "nodeId"),
WebServicesTestUtils.getXmlInt(element, "id"), WebServicesTestUtils.getXmlInt(element, "id"),
WebServicesTestUtils.getXmlLong(element, "startTime"), WebServicesTestUtils.getXmlLong(element, "startTime"),
WebServicesTestUtils.getXmlString(element, "containerId"), WebServicesTestUtils.getXmlString(element, "containerId"),
@ -787,7 +789,8 @@ public void verifyHsJobAttemptsXML(NodeList nodes, Job job) {
} }
public void verifyHsJobAttemptsGeneric(Job job, String nodeHttpAddress, public void verifyHsJobAttemptsGeneric(Job job, String nodeHttpAddress,
int id, long startTime, String containerId, String logsLink) { String nodeId, int id, long startTime, String containerId,
String logsLink) {
boolean attemptFound = false; boolean attemptFound = false;
for (AMInfo amInfo : job.getAMInfos()) { for (AMInfo amInfo : job.getAMInfos()) {
if (amInfo.getAppAttemptId().getAttemptId() == id) { if (amInfo.getAppAttemptId().getAttemptId() == id) {
@ -801,10 +804,9 @@ public void verifyHsJobAttemptsGeneric(Job job, String nodeHttpAddress,
WebServicesTestUtils.checkStringMatch("containerId", amInfo WebServicesTestUtils.checkStringMatch("containerId", amInfo
.getContainerId().toString(), containerId); .getContainerId().toString(), containerId);
String localLogsLink = join( String localLogsLink = join("hsmockwebapp",
"hsmockwebapp", ujoin("logs", nodeId, containerId, MRApps.toString(job.getID()),
ujoin("logs", nodeHttpAddress, containerId, job.getUserName()));
MRApps.toString(job.getID()), job.getUserName()));
assertTrue("logsLink", logsLink.contains(localLogsLink)); assertTrue("logsLink", logsLink.contains(localLogsLink));
} }