Merge r1607655 from trunk: YARN-2242. Improve exception information on AM launch crashes. (Contributed by Li Lu)

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2@1607656 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Junping Du 2014-07-03 14:19:18 +00:00
parent 33248102a1
commit 0d50c2f697
3 changed files with 15 additions and 4 deletions

View File

@ -8,6 +8,9 @@ Release 2.6.0 - UNRELEASED
IMPROVEMENTS
YARN-2242. Improve exception information on AM launch crashes. (Li Lu
via junping_du)
OPTIMIZATIONS
BUG FIXES

View File

@ -1269,14 +1269,14 @@ private void setAMContainerCrashedDiagnosticsAndExitStatus(
this.amContainerExitStatus = status.getExitStatus();
}
private static String getAMContainerCrashedDiagnostics(
private String getAMContainerCrashedDiagnostics(
RMAppAttemptContainerFinishedEvent finishEvent) {
ContainerStatus status = finishEvent.getContainerStatus();
String diagnostics =
"AM Container for " + finishEvent.getApplicationAttemptId()
+ " exited with " + " exitCode: " + status.getExitStatus()
+ " due to: " + status.getDiagnostics() + "."
+ "Failing this attempt.";
+ " exited with " + " exitCode: " + status.getExitStatus() + ". "
+ "Check application tracking page: " + this.getTrackingUrl()
+ " . Then, click on links to logs of each attempt for detailed output. ";
return diagnostics;
}

View File

@ -815,6 +815,7 @@ public void testAMCrashAtAllocated() {
applicationAttempt.getAppAttemptState());
verifyTokenCount(applicationAttempt.getAppAttemptId(), 1);
verifyApplicationAttemptFinished(RMAppAttemptState.FAILED);
verifyAMCrashAtAllocatedDiagnosticInfo(applicationAttempt.getDiagnostics());
}
@Test
@ -1232,6 +1233,13 @@ scheduler, masterService, submissionContext, new Configuration(),
verifyApplicationAttemptFinished(RMAppAttemptState.FAILED);
}
private void verifyAMCrashAtAllocatedDiagnosticInfo(String diagnostics) {
assertTrue("Diagnostic information does not contain application proxy URL",
diagnostics.contains(applicationAttempt.getWebProxyBase()));
assertTrue("Diagnostic information does not point the logs to the users",
diagnostics.contains("logs"));
}
private void verifyTokenCount(ApplicationAttemptId appAttemptId, int count) {
verify(amRMTokenManager, times(count)).applicationMasterFinished(appAttemptId);
if (UserGroupInformation.isSecurityEnabled()) {