Просмотр исходного кода

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
Junping Du 11 лет назад
Родитель
Сommit
5cb489f9d3

+ 3 - 0
hadoop-yarn-project/CHANGES.txt

@@ -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

+ 4 - 4
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

@@ -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;
   }
 

+ 8 - 0
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

@@ -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()) {