java.lang.Object
org.apache.hadoop.yarn.server.nodemanager.containermanager.linux.privileged.PrivilegedOperationExecutor

@Private @Unstable public class PrivilegedOperationExecutor extends Object
provides mechanisms to execute PrivilegedContainerOperations *
  • Method Details

    • getContainerExecutorExecutablePath

      public static String getContainerExecutorExecutablePath(org.apache.hadoop.conf.Configuration conf)
    • getInstance

      public static PrivilegedOperationExecutor getInstance(org.apache.hadoop.conf.Configuration conf)
    • getPrivilegedOperationExecutionCommand

      public String[] getPrivilegedOperationExecutionCommand(List<String> prefixCommands, PrivilegedOperation operation)
      Parameters:
      prefixCommands - in some cases ( e.g priorities using nice ), prefix commands are necessary
      operation - 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 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:
      prefixCommands - in some cases ( e.g priorities using nice ), prefix commands are necessary
      operation - the type and arguments for the operation to be executed
      workingDir - (optional) working directory for execution
      env - (optional) env of the command will include specified vars
      grabOutput - return (possibly large) shell command output
      inheritParentEnv - 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 executed
      grabOutput - 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:
      PrivilegedOperationException
      InterruptedException
    • 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