Class WindowsSecureContainerExecutor
java.lang.Object
org.apache.hadoop.yarn.server.nodemanager.ContainerExecutor
org.apache.hadoop.yarn.server.nodemanager.DefaultContainerExecutor
org.apache.hadoop.yarn.server.nodemanager.WindowsSecureContainerExecutor
- All Implemented Interfaces:
org.apache.hadoop.conf.Configurable
Windows secure container executor (WSCE).
This class offers a secure container executor on Windows, similar to the
LinuxContainerExecutor. As the NM does not run on a high privileged context,
this class delegates elevated operations to the helper hadoopwintuilsvc,
implemented by the winutils.exe running as a service.
JNI and LRPC is used to communicate with the privileged service.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.hadoop.yarn.server.nodemanager.DefaultContainerExecutor
DefaultContainerExecutor.LocalWrapperScriptBuilderNested classes/interfaces inherited from class org.apache.hadoop.yarn.server.nodemanager.ContainerExecutor
ContainerExecutor.DelayedProcessKiller, ContainerExecutor.ExitCode, ContainerExecutor.Signal -
Field Summary
FieldsFields inherited from class org.apache.hadoop.yarn.server.nodemanager.DefaultContainerExecutor
lfsFields inherited from class org.apache.hadoop.yarn.server.nodemanager.ContainerExecutor
DIRECTORY_CONTENTS, TASK_LAUNCH_SCRIPT_PERMISSION, TOKEN_FILE_NAME_FMT, WILDCARD -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected org.apache.hadoop.util.Shell.CommandExecutorbuildCommandExecutor(String wrapperScriptPath, String containerIdStr, String userName, org.apache.hadoop.fs.Path pidFile, org.apache.hadoop.yarn.api.records.Resource resource, File wordDir, Map<String, String> environment, String[] numaCommands) Create a newShell.ShellCommandExecutorusing the parameters.protected voidCopy a file using theDefaultContainerExecutor.lfsFileContext.protected voidcreateDir(org.apache.hadoop.fs.Path dirPath, org.apache.hadoop.fs.permission.FsPermission perms, boolean createParent, String owner) Use theDefaultContainerExecutor.lfsFileContextto create the target directory.getLocalWrapperScriptBuilder(String containerIdStr, org.apache.hadoop.fs.Path containerWorkDir) Create aDefaultContainerExecutor.LocalWrapperScriptBuilderfor the given container ID and path that is appropriate to the current platform.protected String[]getRunCommand(String command, String groupId, String userName, org.apache.hadoop.fs.Path pidFile, org.apache.hadoop.conf.Configuration conf) Return a command line to execute the given command in the OS shell.protected voidkillContainer(String pid, ContainerExecutor.Signal signal) Send a specified signal to the specified pidorg.apache.hadoop.fs.PathlocalizeClasspathJar(org.apache.hadoop.fs.Path jarPath, org.apache.hadoop.fs.Path target, String owner) This function localizes the JAR file on-demand.voidsetConf(org.apache.hadoop.conf.Configuration conf) protected voidsetScriptExecutable(org.apache.hadoop.fs.Path script, String owner) Make a file executable using theDefaultContainerExecutor.lfsFileContext.voidPrepare the environment for containers in this application to execute.Methods inherited from class org.apache.hadoop.yarn.server.nodemanager.DefaultContainerExecutor
clearLogDirPermissions, containerIsAlive, createContainerLocalizer, deleteAsUser, execContainer, getLogDirPermissions, getWorkingDir, init, isContainerAlive, launchContainer, postComplete, reacquireContainer, reapContainer, relaunchContainer, setNumactl, setNumaResourceAllocator, signalContainer, symLink, updateYarnSysFSMethods inherited from class org.apache.hadoop.yarn.server.nodemanager.ContainerExecutor
activateContainer, cleanupBeforeRelaunch, deactivateContainer, getConf, getExposedPorts, getIpAndHost, getLocalIpAndHost, getLocalResources, getNMEnvVar, getPidFilePath, getProcessId, getRunCommand, getRunCommandForOther, getRunCommandForWindows, isContainerActive, logOutput, pauseContainer, prepareContainer, readDirAsUser, resumeContainer, start, stop, writeLaunchEnv, writeLaunchEnv
-
Field Details
-
LOCALIZER_PID_FORMAT
- See Also:
-
-
Constructor Details
-
WindowsSecureContainerExecutor
- Throws:
IOExceptionURISyntaxException
-
-
Method Details
-
setConf
public void setConf(org.apache.hadoop.conf.Configuration conf) - Specified by:
setConfin interfaceorg.apache.hadoop.conf.Configurable- Overrides:
setConfin classContainerExecutor
-
getRunCommand
protected String[] getRunCommand(String command, String groupId, String userName, org.apache.hadoop.fs.Path pidFile, org.apache.hadoop.conf.Configuration conf) Description copied from class:ContainerExecutorReturn a command line to execute the given command in the OS shell. On Windows, the {code}groupId{code} parameter can be used to launch and associate the given GID with a process group. On non-Windows hosts, the {code}groupId{code} parameter is ignored.- Overrides:
getRunCommandin classContainerExecutor- Parameters:
command- the command to executegroupId- the job owner's GIDuserName- the job owner's usernamepidFile- the path to the container's PID fileconf- the configuration- Returns:
- the command line to execute
-
getLocalWrapperScriptBuilder
protected DefaultContainerExecutor.LocalWrapperScriptBuilder getLocalWrapperScriptBuilder(String containerIdStr, org.apache.hadoop.fs.Path containerWorkDir) Description copied from class:DefaultContainerExecutorCreate aDefaultContainerExecutor.LocalWrapperScriptBuilderfor the given container ID and path that is appropriate to the current platform.- Overrides:
getLocalWrapperScriptBuilderin classDefaultContainerExecutor- Parameters:
containerIdStr- the container IDcontainerWorkDir- the container's working directory- Returns:
- a new
DefaultContainerExecutor.LocalWrapperScriptBuilder
-
copyFile
protected void copyFile(org.apache.hadoop.fs.Path src, org.apache.hadoop.fs.Path dst, String owner) throws IOException Description copied from class:DefaultContainerExecutorCopy a file using theDefaultContainerExecutor.lfsFileContext.- Overrides:
copyFilein classDefaultContainerExecutor- Parameters:
src- the file to copydst- where to copy the fileowner- the owner of the new copy. Used only in secure Windows clusters- Throws:
IOException- when the copy fails- See Also:
-
createDir
protected void createDir(org.apache.hadoop.fs.Path dirPath, org.apache.hadoop.fs.permission.FsPermission perms, boolean createParent, String owner) throws IOException Description copied from class:DefaultContainerExecutorUse theDefaultContainerExecutor.lfsFileContextto create the target directory.- Overrides:
createDirin classDefaultContainerExecutor- Parameters:
dirPath- the target directoryperms- the target permissions for the target directorycreateParent- whether the parent directories should also be createdowner- the user as whom the target directory should be created. Used only on secure Windows hosts.- Throws:
IOException- if there's a failure performing a file operation- See Also:
-
setScriptExecutable
protected void setScriptExecutable(org.apache.hadoop.fs.Path script, String owner) throws IOException Description copied from class:DefaultContainerExecutorMake a file executable using theDefaultContainerExecutor.lfsFileContext.- Overrides:
setScriptExecutablein classDefaultContainerExecutor- Parameters:
script- the path to make executableowner- the new owner for the file. Used only in secure Windows clusters- Throws:
IOException- when the change mode operation fails- See Also:
-
localizeClasspathJar
public org.apache.hadoop.fs.Path localizeClasspathJar(org.apache.hadoop.fs.Path jarPath, org.apache.hadoop.fs.Path target, String owner) throws IOException Description copied from class:ContainerExecutorThis function localizes the JAR file on-demand. On Windows the ContainerLaunch creates a temporary special JAR manifest of other JARs to workaround the CLASSPATH length. In a secure cluster this JAR must be localized so that the container has access to it. The default implementation returns the classpath passed to it, which is expected to have been created in the node manager's fprivate folder, which will not work with secure Windows clusters.- Overrides:
localizeClasspathJarin classContainerExecutor- Parameters:
jarPath- the path to the JAR to localizetarget- the directory where the JAR file should be localizedowner- the name of the user who should own the localized file- Returns:
- the path to the localized JAR file
- Throws:
IOException- if localization fails
-
startLocalizer
Description copied from class:ContainerExecutorPrepare the environment for containers in this application to execute.For $x in local.dirs create $x/$user/$appId Copy $nmLocal/appTokens -> $N/$user/$appId For $rsrc in private resources Copy $rsrc -> $N/$user/filecache/[idef] For $rsrc in job resources Copy $rsrc -> $N/$user/$appId/filecache/idef
- Overrides:
startLocalizerin classDefaultContainerExecutor- Parameters:
ctx- LocalizerStartContext that encapsulates necessary information for starting a localizer.- Throws:
IOException- for most application init failuresInterruptedException- if application init thread is halted by NM
-
buildCommandExecutor
protected org.apache.hadoop.util.Shell.CommandExecutor buildCommandExecutor(String wrapperScriptPath, String containerIdStr, String userName, org.apache.hadoop.fs.Path pidFile, org.apache.hadoop.yarn.api.records.Resource resource, File wordDir, Map<String, String> environment, String[] numaCommands) Description copied from class:DefaultContainerExecutorCreate a newShell.ShellCommandExecutorusing the parameters.- Overrides:
buildCommandExecutorin classDefaultContainerExecutor- Parameters:
wrapperScriptPath- the path to the script to executecontainerIdStr- the container IDuserName- the application owner's usernamepidFile- the path to the container's PID fileresource- this parameter controls memory and CPU limits.wordDir- If not-null, specifies the directory which should be set as the current working directory for the command. If null, the current working directory is not modified.environment- the container environmentnumaCommands- list of prefix numa commands- Returns:
- the new
Shell.ShellCommandExecutor - See Also:
-
Shell.ShellCommandExecutor
-
killContainer
Description copied from class:DefaultContainerExecutorSend a specified signal to the specified pid- Overrides:
killContainerin classDefaultContainerExecutor- Parameters:
pid- the pid of the process [group] to signal.signal- signal to send- Throws:
IOException- if the command to kill the process fails
-