YARN-9419. Log a warning if GPU isolation is enabled but LinuxContainerExecutor is disabled. Contribued by Andras Gyori

This commit is contained in:
Szilard Nemeth 2020-03-09 16:08:24 +01:00
parent c734d69a55
commit 44afe1154d

View File

@ -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<? extends ContainerExecutor> 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,