From 44afe1154dd8ce937470c04a126310989f3dc2cb Mon Sep 17 00:00:00 2001 From: Szilard Nemeth Date: Mon, 9 Mar 2020 16:08:24 +0100 Subject: [PATCH] YARN-9419. Log a warning if GPU isolation is enabled but LinuxContainerExecutor is disabled. Contribued by Andras Gyori --- .../resourceplugin/gpu/GpuResourcePlugin.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) 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/resourceplugin/gpu/GpuResourcePlugin.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/resourceplugin/gpu/GpuResourcePlugin.java index 25ea19396b..233dd0dabe 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/resourceplugin/gpu/GpuResourcePlugin.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/resourceplugin/gpu/GpuResourcePlugin.java @@ -20,9 +20,12 @@ import java.util.List; +import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.yarn.conf.YarnConfiguration; import org.apache.hadoop.yarn.exceptions.YarnException; +import org.apache.hadoop.yarn.server.nodemanager.ContainerExecutor; import org.apache.hadoop.yarn.server.nodemanager.Context; +import org.apache.hadoop.yarn.server.nodemanager.DefaultContainerExecutor; import org.apache.hadoop.yarn.server.nodemanager.containermanager.linux.privileged.PrivilegedOperationExecutor; import org.apache.hadoop.yarn.server.nodemanager.containermanager.linux.resources.CGroupsHandler; import org.apache.hadoop.yarn.server.nodemanager.containermanager.linux.resources.ResourceHandler; @@ -59,6 +62,7 @@ public GpuResourcePlugin(GpuNodeResourceUpdateHandler resourceDiscoverHandler, @Override public void initialize(Context context) throws YarnException { + validateExecutorConfig(context.getConf()); this.gpuDiscoverer.initialize(context.getConf(), new NvidiaBinaryHelper()); this.dockerCommandPlugin = @@ -66,6 +70,17 @@ public void initialize(Context context) throws YarnException { context.getConf()); } + private void validateExecutorConfig(Configuration conf) { + Class executorClass = conf.getClass( + YarnConfiguration.NM_CONTAINER_EXECUTOR, DefaultContainerExecutor.class, + ContainerExecutor.class); + + if (executorClass.equals(DefaultContainerExecutor.class)) { + LOG.warn("Using GPU plugin with disabled LinuxContainerExecutor" + + " is considered to be unsafe."); + } + } + @Override public ResourceHandler createResourceHandler( Context context, CGroupsHandler cGroupsHandler,