From 051a622b572585d2a367e3b2e37eeba3a7db5db7 Mon Sep 17 00:00:00 2001 From: Zhihai Xu Date: Tue, 18 Aug 2015 11:36:02 -0700 Subject: [PATCH] YARN-4057. If ContainersMonitor is not enabled, only print related log info one time. Contributed by Jun Gong. (cherry picked from commit 14215c8ef83d58b8443c52a3cb93e6d44fc87065) --- hadoop-yarn-project/CHANGES.txt | 3 +++ .../monitor/ContainersMonitorImpl.java | 10 +++++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/hadoop-yarn-project/CHANGES.txt b/hadoop-yarn-project/CHANGES.txt index 1c75cb29d79..e8087eb29d8 100644 --- a/hadoop-yarn-project/CHANGES.txt +++ b/hadoop-yarn-project/CHANGES.txt @@ -349,6 +349,9 @@ Release 2.8.0 - UNRELEASED YARN-4031. Add JvmPauseMonitor to ApplicationHistoryServer and WebAppProxyServer (djp via rkanter) + YARN-4057. If ContainersMonitor is not enabled, only print + related log info one time. (Jun Gong via zxu) + OPTIMIZATIONS YARN-3339. TestDockerContainerExecutor should pull a single image and not 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/ContainersMonitorImpl.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/ContainersMonitorImpl.java index 89dc980c707..afb51ad28bb 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/ContainersMonitorImpl.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/ContainersMonitorImpl.java @@ -73,6 +73,7 @@ public class ContainersMonitorImpl extends AbstractService implements private boolean pmemCheckEnabled; private boolean vmemCheckEnabled; + private boolean containersMonitorEnabled; private long maxVCoresAllottedForContainers; @@ -153,6 +154,9 @@ public class ContainersMonitorImpl extends AbstractService implements LOG.info("Physical memory check enabled: " + pmemCheckEnabled); LOG.info("Virtual memory check enabled: " + vmemCheckEnabled); + containersMonitorEnabled = isEnabled(); + LOG.info("ContainersMonitor enabled: " + containersMonitorEnabled); + nodeCpuPercentageForYARN = NodeManagerHardwareUtils.getNodeCpuPercentage(conf); @@ -205,7 +209,7 @@ public class ContainersMonitorImpl extends AbstractService implements @Override protected void serviceStart() throws Exception { - if (this.isEnabled()) { + if (containersMonitorEnabled) { this.monitoringThread.start(); } super.serviceStart(); @@ -213,7 +217,7 @@ public class ContainersMonitorImpl extends AbstractService implements @Override protected void serviceStop() throws Exception { - if (this.isEnabled()) { + if (containersMonitorEnabled) { this.monitoringThread.interrupt(); try { this.monitoringThread.join(); @@ -648,7 +652,7 @@ public class ContainersMonitorImpl extends AbstractService implements @Override public void handle(ContainersMonitorEvent monitoringEvent) { - if (!isEnabled()) { + if (!containersMonitorEnabled) { return; }