Browse Source

svn merge -c 1411289 FIXES: YARN-219. NM should aggregate logs when application finishes. (bobby)

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-0.23@1411299 13f79535-47bb-0310-9956-ffa450edef68
Robert Joseph Evans 12 years ago
parent
commit
34957a478e

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

@@ -109,6 +109,8 @@ Release 0.23.5 - UNRELEASED
     YARN-144. MiniMRYarnCluster launches RM and JHS on default ports (Robert
     Parker via jlowe)
 
+    YARN-219. NM should aggregate logs when application finishes. (bobby)
+
 Release 0.23.4
 
   INCOMPATIBLE CHANGES

+ 8 - 10
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/logaggregation/AppLogAggregatorImpl.java

@@ -149,16 +149,13 @@ public class AppLogAggregatorImpl implements AppLogAggregator {
     ContainerId containerId;
 
     while (!this.appFinishing.get()) {
-      try {
-        containerId = this.pendingContainers.poll();
-        if (containerId == null) {
-          Thread.sleep(THREAD_SLEEP_TIME);
-        } else {
-          uploadLogsForContainer(containerId);
+      synchronized(this) {
+        try {
+          wait(THREAD_SLEEP_TIME);
+        } catch (InterruptedException e) {
+          LOG.warn("PendingContainers queue is interrupted");
+          this.appFinishing.set(true);
         }
-      } catch (InterruptedException e) {
-        LOG.warn("PendingContainers queue is interrupted");
-        this.appFinishing.set(true);
       }
     }
 
@@ -251,8 +248,9 @@ public class AppLogAggregatorImpl implements AppLogAggregator {
   }
 
   @Override
-  public void finishLogAggregation() {
+  public synchronized void finishLogAggregation() {
     LOG.info("Application just finished : " + this.applicationId);
     this.appFinishing.set(true);
+    this.notifyAll();
   }
 }