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,