hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From szege...@apache.org
Subject [10/10] hadoop git commit: YARN-6739. Crash NM at start time if oversubscription is on but LinuxContainerExcutor or cgroup is off. Contributed by Haibo Chen.
Date Mon, 02 Apr 2018 22:36:22 GMT
YARN-6739. Crash NM at start time if oversubscription is on but LinuxContainerExcutor or cgroup
is off. Contributed by Haibo Chen.


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

Branch: refs/heads/YARN-1011
Commit: dece162b0872c7356f3dc4293300ae2698584493
Parents: 29de8de
Author: Miklos Szegedi <szegedim@apache.org>
Authored: Mon Apr 2 15:09:52 2018 -0700
Committer: Miklos Szegedi <szegedim@apache.org>
Committed: Mon Apr 2 15:35:06 2018 -0700

----------------------------------------------------------------------
 .../monitor/ContainersMonitorImpl.java          | 27 ++++++++++++++++++++
 1 file changed, 27 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/dece162b/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
----------------------------------------------------------------------
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 4863ee2..540e8eb 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
@@ -20,6 +20,9 @@ package org.apache.hadoop.yarn.server.nodemanager.containermanager.monitor;
 
 import com.google.common.annotations.VisibleForTesting;
 import com.google.common.base.Preconditions;
+import org.apache.hadoop.yarn.exceptions.YarnException;
+import org.apache.hadoop.yarn.server.nodemanager.LinuxContainerExecutor;
+import org.apache.hadoop.yarn.server.nodemanager.containermanager.linux.resources.ResourceHandlerModule;
 import org.apache.hadoop.yarn.server.nodemanager.metrics.NodeManagerMetrics;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -184,6 +187,7 @@ public class ContainersMonitorImpl extends AbstractService implements
 
     initializeOverAllocation(conf);
     if (context.isOverAllocationEnabled()) {
+      checkOverAllocationPrerequisites();
       pmemCheckEnabled = true;
       LOG.info("Force enabling physical memory checks because " +
           "overallocation is enabled");
@@ -223,6 +227,29 @@ public class ContainersMonitorImpl extends AbstractService implements
     super.serviceInit(this.conf);
   }
 
+  /**
+   * Check all prerequisites for NM over-allocation.
+   */
+  private void checkOverAllocationPrerequisites() throws YarnException {
+    // LinuxContainerExecutor is required to enable overallocation
+    if (!(containerExecutor instanceof LinuxContainerExecutor)) {
+      throw new YarnException(LinuxContainerExecutor.class.getName() +
+          " is required for overallocation");
+    }
+    if (ResourceHandlerModule.getCGroupsHandler() == null) {
+      throw new YarnException("CGroups must be enabled to support" +
+          " overallocation");
+    }
+    if (ResourceHandlerModule.getCpuResourceHandler() == null) {
+      throw new YarnException(
+          "CGroups cpu isolation must be enabled to support overallocation");
+    }
+    if (ResourceHandlerModule.getMemoryResourceHandler() == null) {
+      throw new YarnException(
+          "CGroups memory isolation must be enabled for overallocation");
+    }
+  }
+
   private boolean isContainerMonitorEnabled() {
     return conf.getBoolean(YarnConfiguration.NM_CONTAINER_MONITOR_ENABLED,
         YarnConfiguration.DEFAULT_NM_CONTAINER_MONITOR_ENABLED);


---------------------------------------------------------------------
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