From 0d50c2f6975ce7dbcc153654978605515634d05e Mon Sep 17 00:00:00 2001 From: Junping Du Date: Thu, 3 Jul 2014 14:19:18 +0000 Subject: [PATCH] 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 --- hadoop-yarn-project/CHANGES.txt | 3 +++ .../resourcemanager/rmapp/attempt/RMAppAttemptImpl.java | 8 ++++---- .../rmapp/attempt/TestRMAppAttemptTransitions.java | 8 ++++++++ 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/hadoop-yarn-project/CHANGES.txt b/hadoop-yarn-project/CHANGES.txt index 1abb019ccc9..f4189eb0c7a 100644 --- a/hadoop-yarn-project/CHANGES.txt +++ b/hadoop-yarn-project/CHANGES.txt @@ -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 diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/rmapp/attempt/RMAppAttemptImpl.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/rmapp/attempt/RMAppAttemptImpl.java index ef572d42daa..b57436b9155 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/rmapp/attempt/RMAppAttemptImpl.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/rmapp/attempt/RMAppAttemptImpl.java @@ -1269,14 +1269,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; } diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/rmapp/attempt/TestRMAppAttemptTransitions.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/rmapp/attempt/TestRMAppAttemptTransitions.java index a4f173df190..e334293afa1 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/rmapp/attempt/TestRMAppAttemptTransitions.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/rmapp/attempt/TestRMAppAttemptTransitions.java @@ -815,6 +815,7 @@ public class TestRMAppAttemptTransitions { applicationAttempt.getAppAttemptState()); verifyTokenCount(applicationAttempt.getAppAttemptId(), 1); verifyApplicationAttemptFinished(RMAppAttemptState.FAILED); + verifyAMCrashAtAllocatedDiagnosticInfo(applicationAttempt.getDiagnostics()); } @Test @@ -1232,6 +1233,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()) {