public class WindowsSecureContainerExecutor extends DefaultContainerExecutor
DefaultContainerExecutor.LocalWrapperScriptBuilder
ContainerExecutor.DelayedProcessKiller, ContainerExecutor.ExitCode, ContainerExecutor.Signal
Modifier and Type | Field and Description |
---|---|
static String |
LOCALIZER_PID_FORMAT |
lfs
DIRECTORY_CONTENTS, TASK_LAUNCH_SCRIPT_PERMISSION, TOKEN_FILE_NAME_FMT, WILDCARD
Constructor and Description |
---|
WindowsSecureContainerExecutor() |
Modifier and Type | Method and Description |
---|---|
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)
Create a new
Shell.ShellCommandExecutor using the parameters. |
protected void |
copyFile(org.apache.hadoop.fs.Path src,
org.apache.hadoop.fs.Path dst,
String owner)
Copy a file using the
DefaultContainerExecutor.lfs FileContext . |
protected void |
createDir(org.apache.hadoop.fs.Path dirPath,
org.apache.hadoop.fs.permission.FsPermission perms,
boolean createParent,
String owner)
Use the
DefaultContainerExecutor.lfs FileContext to create the target directory. |
protected DefaultContainerExecutor.LocalWrapperScriptBuilder |
getLocalWrapperScriptBuilder(String containerIdStr,
org.apache.hadoop.fs.Path containerWorkDir)
Create a
DefaultContainerExecutor.LocalWrapperScriptBuilder for 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 void |
killContainer(String pid,
ContainerExecutor.Signal signal)
Send a specified signal to the specified pid
|
org.apache.hadoop.fs.Path |
localizeClasspathJar(org.apache.hadoop.fs.Path jarPath,
org.apache.hadoop.fs.Path target,
String owner)
This function localizes the JAR file on-demand.
|
void |
setConf(org.apache.hadoop.conf.Configuration conf) |
protected void |
setScriptExecutable(org.apache.hadoop.fs.Path script,
String owner)
Make a file executable using the
DefaultContainerExecutor.lfs FileContext . |
void |
startLocalizer(LocalizerStartContext ctx)
Prepare the environment for containers in this application to execute.
|
clearLogDirPermissions, containerIsAlive, createContainerLocalizer, deleteAsUser, execContainer, getLogDirPermissions, getWorkingDir, init, isContainerAlive, launchContainer, reapContainer, relaunchContainer, signalContainer, symLink, updateYarnSysFS
activateContainer, cleanupBeforeRelaunch, deactivateContainer, getConf, getExposedPorts, getIpAndHost, getLocalIpAndHost, getLocalResources, getNMEnvVar, getPidFilePath, getProcessId, getRunCommand, getRunCommandForOther, getRunCommandForWindows, isContainerActive, logOutput, pauseContainer, prepareContainer, reacquireContainer, readDirAsUser, resumeContainer, start, stop, writeLaunchEnv, writeLaunchEnv
public static final String LOCALIZER_PID_FORMAT
public WindowsSecureContainerExecutor() throws IOException, URISyntaxException
IOException
URISyntaxException
public void setConf(org.apache.hadoop.conf.Configuration conf)
setConf
in interface org.apache.hadoop.conf.Configurable
setConf
in class ContainerExecutor
protected String[] getRunCommand(String command, String groupId, String userName, org.apache.hadoop.fs.Path pidFile, org.apache.hadoop.conf.Configuration conf)
ContainerExecutor
getRunCommand
in class ContainerExecutor
command
- the command to executegroupId
- the job owner's GIDuserName
- the job owner's usernamepidFile
- the path to the container's PID fileconf
- the configurationprotected DefaultContainerExecutor.LocalWrapperScriptBuilder getLocalWrapperScriptBuilder(String containerIdStr, org.apache.hadoop.fs.Path containerWorkDir)
DefaultContainerExecutor
DefaultContainerExecutor.LocalWrapperScriptBuilder
for the given container ID
and path that is appropriate to the current platform.getLocalWrapperScriptBuilder
in class DefaultContainerExecutor
containerIdStr
- the container IDcontainerWorkDir
- the container's working directoryDefaultContainerExecutor.LocalWrapperScriptBuilder
protected void copyFile(org.apache.hadoop.fs.Path src, org.apache.hadoop.fs.Path dst, String owner) throws IOException
DefaultContainerExecutor
DefaultContainerExecutor.lfs
FileContext
.copyFile
in class DefaultContainerExecutor
src
- the file to copydst
- where to copy the fileowner
- the owner of the new copy. Used only in secure Windows
clustersIOException
- when the copy failsWindowsSecureContainerExecutor
protected void createDir(org.apache.hadoop.fs.Path dirPath, org.apache.hadoop.fs.permission.FsPermission perms, boolean createParent, String owner) throws IOException
DefaultContainerExecutor
DefaultContainerExecutor.lfs
FileContext
to create the target directory.createDir
in class DefaultContainerExecutor
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.IOException
- if there's a failure performing a file operationWindowsSecureContainerExecutor
protected void setScriptExecutable(org.apache.hadoop.fs.Path script, String owner) throws IOException
DefaultContainerExecutor
DefaultContainerExecutor.lfs
FileContext
.setScriptExecutable
in class DefaultContainerExecutor
script
- the path to make executableowner
- the new owner for the file. Used only in secure Windows
clustersIOException
- when the change mode operation failsWindowsSecureContainerExecutor
public org.apache.hadoop.fs.Path localizeClasspathJar(org.apache.hadoop.fs.Path jarPath, org.apache.hadoop.fs.Path target, String owner) throws IOException
ContainerExecutor
localizeClasspathJar
in class ContainerExecutor
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 fileIOException
- if localization failspublic void startLocalizer(LocalizerStartContext ctx) throws IOException, InterruptedException
ContainerExecutor
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
startLocalizer
in class DefaultContainerExecutor
ctx
- LocalizerStartContext that encapsulates necessary information
for starting a localizer.IOException
- for most application init failuresInterruptedException
- if application init thread is halted by NMprotected 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)
DefaultContainerExecutor
Shell.ShellCommandExecutor
using the parameters.buildCommandExecutor
in class DefaultContainerExecutor
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 environmentShell.ShellCommandExecutor
Shell.ShellCommandExecutor
protected void killContainer(String pid, ContainerExecutor.Signal signal) throws IOException
DefaultContainerExecutor
killContainer
in class DefaultContainerExecutor
pid
- the pid of the process [group] to signal.signal
- signal to sendIOException
- if the command to kill the process failsCopyright © 2008–2023 Apache Software Foundation. All rights reserved.