Class PrivilegedOperationExecutor
java.lang.Object
org.apache.hadoop.yarn.server.nodemanager.containermanager.linux.privileged.PrivilegedOperationExecutor
provides mechanisms to execute PrivilegedContainerOperations *
-
Method Summary
Modifier and TypeMethodDescriptionorg.apache.hadoop.hdfs.protocol.datatransfer.IOStreamPairexecutePrivilegedInteractiveOperation(List<String> prefixCommands, PrivilegedOperation operation) executePrivilegedOperation(List<String> prefixCommands, PrivilegedOperation operation, File workingDir, Map<String, String> env, boolean grabOutput, boolean inheritParentEnv) Executes a privileged operation.executePrivilegedOperation(PrivilegedOperation operation, boolean grabOutput) Executes a privileged operation.static StringgetContainerExecutorExecutablePath(org.apache.hadoop.conf.Configuration conf) static PrivilegedOperationExecutorgetInstance(org.apache.hadoop.conf.Configuration conf) String[]getPrivilegedOperationExecutionCommand(List<String> prefixCommands, PrivilegedOperation operation) static PrivilegedOperationSquash operations for cgroups - e.g mount, add pid to cgroup etc ., For now, we only implement squashing for 'add pid to cgroup' since this is the only optimization relevant to launching containers
-
Method Details
-
getContainerExecutorExecutablePath
-
getInstance
-
getPrivilegedOperationExecutionCommand
public String[] getPrivilegedOperationExecutionCommand(List<String> prefixCommands, PrivilegedOperation operation) - Parameters:
prefixCommands- in some cases ( e.g priorities using nice ), prefix commands are necessaryoperation- the type and arguments for the operation to be executed- Returns:
- execution string array for priviledged operation
-
executePrivilegedOperation
public String executePrivilegedOperation(List<String> prefixCommands, PrivilegedOperation operation, File workingDir, Map<String, String> env, boolean grabOutput, boolean inheritParentEnv) throws PrivilegedOperationExceptionExecutes a privileged operation. It is up to the callers to ensure that each privileged operation's parameters are constructed correctly. The parameters are passed verbatim to the container-executor binary.- Parameters:
prefixCommands- in some cases ( e.g priorities using nice ), prefix commands are necessaryoperation- the type and arguments for the operation to be executedworkingDir- (optional) working directory for executionenv- (optional) env of the command will include specified varsgrabOutput- return (possibly large) shell command outputinheritParentEnv- inherit the env vars from the parent process- Returns:
- stdout contents from shell executor - useful for some privileged operations - e.g --tc_read
- Throws:
PrivilegedOperationException
-
executePrivilegedOperation
public String executePrivilegedOperation(PrivilegedOperation operation, boolean grabOutput) throws PrivilegedOperationException Executes a privileged operation. It is up to the callers to ensure that each privileged operation's parameters are constructed correctly. The parameters are passed verbatim to the container-executor binary.- Parameters:
operation- the type and arguments for the operation to be executedgrabOutput- return (possibly large) shell command output- Returns:
- stdout contents from shell executor - useful for some privileged operations - e.g --tc_read
- Throws:
PrivilegedOperationException
-
executePrivilegedInteractiveOperation
public org.apache.hadoop.hdfs.protocol.datatransfer.IOStreamPair executePrivilegedInteractiveOperation(List<String> prefixCommands, PrivilegedOperation operation) throws PrivilegedOperationException, InterruptedException - Parameters:
prefixCommands-operation-- Returns:
- stdin and stdout of container exec
- Throws:
PrivilegedOperationExceptionInterruptedException
-
squashCGroupOperations
public static PrivilegedOperation squashCGroupOperations(List<PrivilegedOperation> ops) throws PrivilegedOperationException Squash operations for cgroups - e.g mount, add pid to cgroup etc ., For now, we only implement squashing for 'add pid to cgroup' since this is the only optimization relevant to launching containers- Returns:
- single squashed cgroup operation. Null on failure.
- Throws:
PrivilegedOperationException
-