Author: bobby Date: Mon Nov 19 16:41:11 2012 New Revision: 1411289 URL: http://svn.apache.org/viewvc?rev=1411289&view=rev Log: YARN-219. NM should aggregate logs when application finishes. (bobby)
Modified: hadoop/common/trunk/hadoop-yarn-project/CHANGES.txt hadoop/common/trunk/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 Modified: hadoop/common/trunk/hadoop-yarn-project/CHANGES.txt URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-yarn-project/CHANGES.txt?rev=1411289&r1=1411288&r2=1411289&view=diff ============================================================================== --- hadoop/common/trunk/hadoop-yarn-project/CHANGES.txt (original) +++ hadoop/common/trunk/hadoop-yarn-project/CHANGES.txt Mon Nov 19 16:41:11 2012 @@ -247,6 +247,8 @@ Release 0.23.5 - UNRELEASED YARN-212. NM state machine ignores an APPLICATION_CONTAINER_FINISHED event when it shouldn't (Nathan Roberts via jlowe) + YARN-219. NM should aggregate logs when application finishes. (bobby) + Release 0.23.4 INCOMPATIBLE CHANGES Modified: hadoop/common/trunk/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 URL: http://svn.apache.org/viewvc/hadoop/common/trunk/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?rev=1411289&r1=1411288&r2=1411289&view=diff ============================================================================== --- hadoop/common/trunk/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 (original) +++ hadoop/common/trunk/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 Mon Nov 19 16:41:11 2012 @@ -149,16 +149,13 @@ public class AppLogAggregatorImpl implem 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 implem } @Override - public void finishLogAggregation() { + public synchronized void finishLogAggregation() { LOG.info("Application just finished : " + this.applicationId); this.appFinishing.set(true); + this.notifyAll(); } }