hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a.@apache.org
Subject [05/50] hadoop git commit: YARN-4795. ContainerMetrics drops records. (Daniel Templeton via kasha)
Date Tue, 03 May 2016 16:59:09 GMT
YARN-4795. ContainerMetrics drops records. (Daniel Templeton via kasha)


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

Branch: refs/heads/HADOOP-12930
Commit: 1a3f1482e2738c7f9a983bc55189116930388d7b
Parents: 4b1dcbb
Author: Karthik Kambatla <kasha@apache.org>
Authored: Tue Apr 26 06:15:36 2016 -0700
Committer: Karthik Kambatla <kasha@apache.org>
Committed: Tue Apr 26 06:15:36 2016 -0700

----------------------------------------------------------------------
 .../containermanager/monitor/ContainerMetrics.java   | 15 +++++----------
 .../monitor/TestContainerMetrics.java                |  7 ++++---
 2 files changed, 9 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/1a3f1482/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/monitor/ContainerMetrics.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/monitor/ContainerMetrics.java
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/monitor/ContainerMetrics.java
index f85431e..d59abda 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/monitor/ContainerMetrics.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/monitor/ContainerMetrics.java
@@ -121,11 +121,10 @@ public class ContainerMetrics implements MetricsSource {
   final MetricsSystem metricsSystem;
 
   // Metrics publishing status
-  private long flushPeriodMs;
+  private final long flushPeriodMs;
+  private final long unregisterDelayMs;
   private boolean flushOnPeriod = false; // true if period elapsed
   private boolean finished = false; // true if container finished
-  private boolean unregister = false; // unregister
-  private long unregisterDelayMs;
   private Timer timer; // lazily initialized
 
   /**
@@ -227,17 +226,11 @@ public class ContainerMetrics implements MetricsSource {
   @Override
   public synchronized void getMetrics(MetricsCollector collector, boolean all) {
     //Container goes through registered -> finished -> unregistered.
-    if (unregister) {
-      return;
-    }
-
     if (finished || flushOnPeriod) {
       registry.snapshot(collector.addRecord(registry.info()), all);
     }
 
-    if (finished) {
-      this.unregister = true;
-    } else if (flushOnPeriod) {
+    if (!finished && flushOnPeriod) {
       flushOnPeriod = false;
       scheduleTimerTaskIfRequired();
     }
@@ -301,6 +294,7 @@ public class ContainerMetrics implements MetricsSource {
       if (timer == null) {
         this.timer = new Timer("Metrics flush checker", true);
       }
+
       TimerTask timerTask = new TimerTask() {
         @Override
         public void run() {
@@ -311,6 +305,7 @@ public class ContainerMetrics implements MetricsSource {
           }
         }
       };
+
       timer.schedule(timerTask, flushPeriodMs);
     }
   }

http://git-wip-us.apache.org/repos/asf/hadoop/blob/1a3f1482/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/monitor/TestContainerMetrics.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/monitor/TestContainerMetrics.java
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/monitor/TestContainerMetrics.java
index fb482c4..60f6604 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/monitor/TestContainerMetrics.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/monitor/TestContainerMetrics.java
@@ -77,11 +77,12 @@ public class TestContainerMetrics {
     collector.clear();
 
     metrics.getMetrics(collector, true);
-    assertEquals(ERR, 0, collector.getRecords().size());
+    assertEquals(ERR, 1, collector.getRecords().size());
+    collector.clear();
 
     Thread.sleep(110);
     metrics.getMetrics(collector, true);
-    assertEquals(ERR, 0, collector.getRecords().size());
+    assertEquals(ERR, 1, collector.getRecords().size());
   }
 
   @Test
@@ -134,7 +135,7 @@ public class TestContainerMetrics {
   public void testContainerMetricsFinished() throws InterruptedException {
     MetricsSystemImpl system = new MetricsSystemImpl();
     system.init("test");
-    MetricsCollectorImpl collector = new MetricsCollectorImpl();
+
     ApplicationId appId = ApplicationId.newInstance(1234, 3);
     ApplicationAttemptId appAttemptId =
         ApplicationAttemptId.newInstance(appId, 4);


---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org


Mime
View raw message