YARN-2242. Improve exception information on AM launch crashes. (Contributed by Li Lu)

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1607655 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Junping Du 2014-07-03 14:15:19 +00:00
parent 1def6cde1f
commit 5cb489f9d3
3 changed files with 15 additions and 4 deletions

View File

@ -26,6 +26,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

@ -1273,14 +1273,14 @@ public class RMAppAttemptImpl implements RMAppAttempt, Recoverable {
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

@ -820,6 +820,7 @@ public class TestRMAppAttemptTransitions {
applicationAttempt.getAppAttemptState());
verifyTokenCount(applicationAttempt.getAppAttemptId(), 1);
verifyApplicationAttemptFinished(RMAppAttemptState.FAILED);
verifyAMCrashAtAllocatedDiagnosticInfo(applicationAttempt.getDiagnostics());
}
@Test
@ -1237,6 +1238,13 @@ public class TestRMAppAttemptTransitions {
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()) {