hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From junping...@apache.org
Subject hadoop git commit: YARN-4452. NPE when submit Unmanaged application. Contributed by Naganarasimha G R. (cherry picked from commit 50bd067e1d63d4c80dc1e7bf4024bfaf42cf4416) (cherry picked from commit 1a2ef845b54166194b133e524ad9533cc259aed2)
Date Thu, 17 Dec 2015 14:09:45 GMT
Repository: hadoop
Updated Branches:
  refs/heads/branch-2.8 cffa262f1 -> 92de57bdc


YARN-4452. NPE when submit Unmanaged application. Contributed by Naganarasimha G R.
(cherry picked from commit 50bd067e1d63d4c80dc1e7bf4024bfaf42cf4416)
(cherry picked from commit 1a2ef845b54166194b133e524ad9533cc259aed2)

Conflicts:

	hadoop-yarn-project/CHANGES.txt
	hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/metrics/SystemMetricsPublisher.java
(cherry picked from commit 0f9dd488428ae65a17043f3a976c6ef778806328)

Conflicts:

	hadoop-yarn-project/CHANGES.txt


Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/92de57bd
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/92de57bd
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/92de57bd

Branch: refs/heads/branch-2.8
Commit: 92de57bdca84350539954e8c839789606941b934
Parents: cffa262
Author: Junping Du <junping_du@apache.org>
Authored: Wed Dec 16 10:57:39 2015 -0800
Committer: Junping Du <junping_du@apache.org>
Committed: Thu Dec 17 06:16:08 2015 -0800

----------------------------------------------------------------------
 hadoop-yarn-project/CHANGES.txt                 |  9 ++++++
 .../metrics/SystemMetricsPublisher.java         | 11 ++++---
 .../metrics/TestSystemMetricsPublisher.java     | 34 ++++++++++++++++----
 3 files changed, 44 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/92de57bd/hadoop-yarn-project/CHANGES.txt
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/CHANGES.txt b/hadoop-yarn-project/CHANGES.txt
index 0d88a8c..5a5e765 100644
--- a/hadoop-yarn-project/CHANGES.txt
+++ b/hadoop-yarn-project/CHANGES.txt
@@ -1051,6 +1051,9 @@ Release 2.8.0 - UNRELEASED
     YARN-4461. Redundant nodeLocalityDelay log in LeafQueue (Eric Payne via
     jlowe)
 
+    YARN-4452. NPE when submit Unmanaged application. (Naganarasimha G R
+    via junping_du)
+
 Release 2.7.3 - UNRELEASED
 
   INCOMPATIBLE CHANGES
@@ -1090,6 +1093,9 @@ Release 2.7.3 - UNRELEASED
 
     YARN-4439. Clarify NMContainerStatus#toString method. (Jian He via xgong)
 
+    YARN-4452. NPE when submit Unmanaged application. (Naganarasimha G R
+    via junping_du)
+
 Release 2.7.2 - UNRELEASED
 
   INCOMPATIBLE CHANGES
@@ -1944,6 +1950,9 @@ Release 2.6.4 - UNRELEASED
 
   BUG FIXES
 
+    YARN-4452. NPE when submit Unmanaged application. (Naganarasimha G R
+    via junping_du)
+
 Release 2.6.3 - UNRELEASED
 
   INCOMPATIBLE CHANGES

http://git-wip-us.apache.org/repos/asf/hadoop/blob/92de57bd/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/metrics/SystemMetricsPublisher.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/metrics/SystemMetricsPublisher.java
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/metrics/SystemMetricsPublisher.java
index 1bf7dbb..71153c2 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/metrics/SystemMetricsPublisher.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/metrics/SystemMetricsPublisher.java
@@ -160,6 +160,8 @@ public class SystemMetricsPublisher extends CompositeService {
   public void appAttemptRegistered(RMAppAttempt appAttempt,
       long registeredTime) {
     if (publishSystemMetrics) {
+      ContainerId container = (appAttempt.getMasterContainer() == null) ? null
+          : appAttempt.getMasterContainer().getId();
       dispatcher.getEventHandler().handle(
           new AppAttemptRegisteredEvent(
               appAttempt.getAppAttemptId(),
@@ -167,7 +169,7 @@ public class SystemMetricsPublisher extends CompositeService {
               appAttempt.getRpcPort(),
               appAttempt.getTrackingUrl(),
               appAttempt.getOriginalTrackingUrl(),
-              appAttempt.getMasterContainer().getId(),
+              container,
               registeredTime));
     }
   }
@@ -389,9 +391,10 @@ public class SystemMetricsPublisher extends CompositeService {
         event.getHost());
     eventInfo.put(AppAttemptMetricsConstants.RPC_PORT_EVENT_INFO,
         event.getRpcPort());
-    eventInfo.put(
-        AppAttemptMetricsConstants.MASTER_CONTAINER_EVENT_INFO,
-        event.getMasterContainerId().toString());
+    if (event.getMasterContainerId() != null) {
+      eventInfo.put(AppAttemptMetricsConstants.MASTER_CONTAINER_EVENT_INFO,
+          event.getMasterContainerId().toString());
+    }
     tEvent.setEventInfo(eventInfo);
     entity.addEvent(tEvent);
     putEntity(entity);

http://git-wip-us.apache.org/repos/asf/hadoop/blob/92de57bd/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/metrics/TestSystemMetricsPublisher.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/metrics/TestSystemMetricsPublisher.java
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/metrics/TestSystemMetricsPublisher.java
index 4835ade..f2b02bc 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/metrics/TestSystemMetricsPublisher.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/metrics/TestSystemMetricsPublisher.java
@@ -257,10 +257,30 @@ public class TestSystemMetricsPublisher {
   }
 
   @Test(timeout = 10000)
+  public void testPublishAppAttemptMetricsForUnmanagedAM() throws Exception {
+    ApplicationAttemptId appAttemptId =
+        ApplicationAttemptId.newInstance(ApplicationId.newInstance(0, 1), 1);
+    RMAppAttempt appAttempt = createRMAppAttempt(appAttemptId,true);
+    metricsPublisher.appAttemptRegistered(appAttempt, Integer.MAX_VALUE + 1L);
+    RMApp app = mock(RMApp.class);
+    when(app.getFinalApplicationStatus()).thenReturn(FinalApplicationStatus.UNDEFINED);
+    metricsPublisher.appAttemptFinished(appAttempt, RMAppAttemptState.FINISHED, app,
+        Integer.MAX_VALUE + 2L);
+    TimelineEntity entity = null;
+    do {
+      entity =
+          store.getEntity(appAttemptId.toString(),
+              AppAttemptMetricsConstants.ENTITY_TYPE,
+              EnumSet.allOf(Field.class));
+      // ensure two events are both published before leaving the loop
+    } while (entity == null || entity.getEvents().size() < 2);
+  }
+
+  @Test(timeout = 10000)
   public void testPublishAppAttemptMetrics() throws Exception {
     ApplicationAttemptId appAttemptId =
         ApplicationAttemptId.newInstance(ApplicationId.newInstance(0, 1), 1);
-    RMAppAttempt appAttempt = createRMAppAttempt(appAttemptId);
+    RMAppAttempt appAttempt = createRMAppAttempt(appAttemptId, false);
     metricsPublisher.appAttemptRegistered(appAttempt, Integer.MAX_VALUE + 1L);
     RMApp app = mock(RMApp.class);
     when(app.getFinalApplicationStatus()).thenReturn(FinalApplicationStatus.UNDEFINED);
@@ -435,15 +455,17 @@ public class TestSystemMetricsPublisher {
   }
 
   private static RMAppAttempt createRMAppAttempt(
-      ApplicationAttemptId appAttemptId) {
+      ApplicationAttemptId appAttemptId, boolean unmanagedAMAttempt) {
     RMAppAttempt appAttempt = mock(RMAppAttempt.class);
     when(appAttempt.getAppAttemptId()).thenReturn(appAttemptId);
     when(appAttempt.getHost()).thenReturn("test host");
     when(appAttempt.getRpcPort()).thenReturn(-100);
-    Container container = mock(Container.class);
-    when(container.getId())
-        .thenReturn(ContainerId.newContainerId(appAttemptId, 1));
-    when(appAttempt.getMasterContainer()).thenReturn(container);
+    if (!unmanagedAMAttempt) {
+      Container container = mock(Container.class);
+      when(container.getId())
+          .thenReturn(ContainerId.newContainerId(appAttemptId, 1));
+      when(appAttempt.getMasterContainer()).thenReturn(container);
+    }
     when(appAttempt.getDiagnostics()).thenReturn("test diagnostics info");
     when(appAttempt.getTrackingUrl()).thenReturn("test tracking url");
     when(appAttempt.getOriginalTrackingUrl()).thenReturn(


Mime
View raw message