YARN-2242. Addendum patch. Improve exception information on AM launch crashes. (Contributed by Li Lu)
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1612565 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
25b0e8471e
commit
afb9394c91
|
@ -1294,12 +1294,20 @@ public class RMAppAttemptImpl implements RMAppAttempt, Recoverable {
|
||||||
private String getAMContainerCrashedDiagnostics(
|
private String getAMContainerCrashedDiagnostics(
|
||||||
RMAppAttemptContainerFinishedEvent finishEvent) {
|
RMAppAttemptContainerFinishedEvent finishEvent) {
|
||||||
ContainerStatus status = finishEvent.getContainerStatus();
|
ContainerStatus status = finishEvent.getContainerStatus();
|
||||||
String diagnostics =
|
StringBuilder diagnosticsBuilder = new StringBuilder();
|
||||||
"AM Container for " + finishEvent.getApplicationAttemptId()
|
diagnosticsBuilder.append("AM Container for ").append(
|
||||||
+ " exited with " + " exitCode: " + status.getExitStatus() + ". "
|
finishEvent.getApplicationAttemptId()).append(
|
||||||
+ "Check application tracking page: " + this.getTrackingUrl()
|
" exited with ").append(" exitCode: ").append(status.getExitStatus()).
|
||||||
+ " . Then, click on links to logs of each attempt for detailed output. ";
|
append("\n");
|
||||||
return diagnostics;
|
if (this.getTrackingUrl() != null) {
|
||||||
|
diagnosticsBuilder.append("For more detailed output,").append(
|
||||||
|
" check application tracking page:").append(
|
||||||
|
this.getTrackingUrl()).append(
|
||||||
|
"Then, click on links to logs of each attempt.\n");
|
||||||
|
}
|
||||||
|
diagnosticsBuilder.append("Diagnostics: ").append(status.getDiagnostics())
|
||||||
|
.append("Failing this attempt");
|
||||||
|
return diagnosticsBuilder.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class FinalTransition extends BaseFinalTransition {
|
private static class FinalTransition extends BaseFinalTransition {
|
||||||
|
|
|
@ -823,7 +823,9 @@ public class TestRMAppAttemptTransitions {
|
||||||
applicationAttempt.getAppAttemptState());
|
applicationAttempt.getAppAttemptState());
|
||||||
verifyTokenCount(applicationAttempt.getAppAttemptId(), 1);
|
verifyTokenCount(applicationAttempt.getAppAttemptId(), 1);
|
||||||
verifyApplicationAttemptFinished(RMAppAttemptState.FAILED);
|
verifyApplicationAttemptFinished(RMAppAttemptState.FAILED);
|
||||||
verifyAMCrashAtAllocatedDiagnosticInfo(applicationAttempt.getDiagnostics());
|
boolean shouldCheckURL = (applicationAttempt.getTrackingUrl() != null);
|
||||||
|
verifyAMCrashAtAllocatedDiagnosticInfo(applicationAttempt.getDiagnostics(),
|
||||||
|
exitCode, shouldCheckURL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -1241,11 +1243,18 @@ public class TestRMAppAttemptTransitions {
|
||||||
verifyApplicationAttemptFinished(RMAppAttemptState.FAILED);
|
verifyApplicationAttemptFinished(RMAppAttemptState.FAILED);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void verifyAMCrashAtAllocatedDiagnosticInfo(String diagnostics) {
|
private void verifyAMCrashAtAllocatedDiagnosticInfo(String diagnostics,
|
||||||
assertTrue("Diagnostic information does not contain application proxy URL",
|
int exitCode, boolean shouldCheckURL) {
|
||||||
diagnostics.contains(applicationAttempt.getWebProxyBase()));
|
|
||||||
assertTrue("Diagnostic information does not point the logs to the users",
|
assertTrue("Diagnostic information does not point the logs to the users",
|
||||||
diagnostics.contains("logs"));
|
diagnostics.contains("logs"));
|
||||||
|
assertTrue("Diagnostic information does not contain application attempt id",
|
||||||
|
diagnostics.contains(applicationAttempt.getAppAttemptId().toString()));
|
||||||
|
assertTrue("Diagnostic information does not contain application exit code",
|
||||||
|
diagnostics.contains("exitCode: " + exitCode));
|
||||||
|
if (shouldCheckURL) {
|
||||||
|
assertTrue("Diagnostic information does not contain application proxy URL",
|
||||||
|
diagnostics.contains(applicationAttempt.getWebProxyBase()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void verifyTokenCount(ApplicationAttemptId appAttemptId, int count) {
|
private void verifyTokenCount(ApplicationAttemptId appAttemptId, int count) {
|
||||||
|
|
Loading…
Reference in New Issue