/** * Set up the {@link ContainerLocalizer}. * * @param command the current ShellCommandExecutor command line * @param user localization user * @param appId localized app id * @param locId localizer id * @param nmAddr nodemanager address * @param localDirs list of local dirs * @see ContainerLocalizer#buildMainArgs */ @VisibleForTesting public void buildMainArgs(List<String> command, String user, String appId, String locId, InetSocketAddress nmAddr, List<String> localDirs) { ContainerLocalizer.buildMainArgs(command, user, appId, locId, nmAddr, localDirs, super.getConf()); }
Configuration conf = super.getConf(); PrivilegedOperationExecutor privilegedOperationExecutor = getPrivilegedOperationExecutor();
public void mountCgroups(List<String> cgroupKVs, String hierarchy) throws IOException { try { PrivilegedOperation mountCGroupsOp = new PrivilegedOperation( PrivilegedOperation.OperationType.MOUNT_CGROUPS, hierarchy); Configuration conf = super.getConf(); mountCGroupsOp.appendArgs(cgroupKVs); PrivilegedOperationExecutor privilegedOperationExecutor = getPrivilegedOperationExecutor(); privilegedOperationExecutor.executePrivilegedOperation(mountCGroupsOp, false); } catch (PrivilegedOperationException e) { int exitCode = e.getExitCode(); LOG.warn("Exception in LinuxContainerExecutor mountCgroups ", e); throw new IOException("Problem mounting cgroups " + cgroupKVs + "; exit code = " + exitCode + " and output: " + e.getOutput(), e); } } }
Configuration conf = super.getConf(); PrivilegedOperationExecutor privilegedOperationExecutor = getPrivilegedOperationExecutor();
/** * Remove the docker container referenced in the context. * * @param containerId the containerId for the container. */ public void removeDockerContainer(String containerId) { try { PrivilegedOperationExecutor privOpExecutor = PrivilegedOperationExecutor.getInstance(super.getConf()); if (DockerCommandExecutor.isRemovable( DockerCommandExecutor.getContainerStatus(containerId, privOpExecutor, nmContext))) { LOG.info("Removing Docker container : " + containerId); DockerRmCommand dockerRmCommand = new DockerRmCommand(containerId, ResourceHandlerModule.getCgroupsRelativeRoot()); DockerCommandExecutor.executeDockerCommand(dockerRmCommand, containerId, null, privOpExecutor, false, nmContext); } } catch (ContainerExecutionException e) { LOG.warn("Unable to remove docker container: " + containerId); } }
@Override public void init(Context context) throws IOException { Configuration conf = super.getConf(); this.nmContext = context;
/** * Mount a CGROUPS controller at the requested mount point and create * a hierarchy for the NodeManager to manage. * * @param cgroupKVs a key-value pair of the form * {@code controller=mount-path} * @param hierarchy the top directory of the hierarchy for the NodeManager * @throws IOException if there is a problem mounting the CGROUPS */ public void mountCgroups(List<String> cgroupKVs, String hierarchy) throws IOException { try { PrivilegedOperation mountCGroupsOp = new PrivilegedOperation( PrivilegedOperation.OperationType.MOUNT_CGROUPS, hierarchy); Configuration conf = super.getConf(); mountCGroupsOp.appendArgs(cgroupKVs); PrivilegedOperationExecutor privilegedOperationExecutor = getPrivilegedOperationExecutor(); privilegedOperationExecutor.executePrivilegedOperation(mountCGroupsOp, false); } catch (PrivilegedOperationException e) { int exitCode = e.getExitCode(); LOG.warn("Exception in LinuxContainerExecutor mountCgroups ", e); throw new IOException("Problem mounting cgroups " + cgroupKVs + "; exit code = " + exitCode + " and output: " + e.getOutput(), e); } }
@Override public void init() throws IOException { Configuration conf = super.getConf();
Configuration conf = super.getConf(); PrivilegedOperationExecutor privilegedOperationExecutor = getPrivilegedOperationExecutor();
Configuration conf = super.getConf(); PrivilegedOperationExecutor privilegedOperationExecutor = getPrivilegedOperationExecutor();