public class DockerContainerExecutor extends ContainerExecutor
ContainerExecutor.DelayedProcessKiller, ContainerExecutor.ExitCode, ContainerExecutor.Signal
Modifier and Type | Field and Description |
---|---|
static String |
DOCKER_CONTAINER_EXECUTOR_SCRIPT |
static String |
DOCKER_CONTAINER_EXECUTOR_SESSION_SCRIPT |
static String |
DOCKER_IMAGE_PATTERN |
DIRECTORY_CONTENTS, TASK_LAUNCH_SCRIPT_PERMISSION
Constructor and Description |
---|
DockerContainerExecutor() |
Modifier and Type | Method and Description |
---|---|
static boolean |
containerIsAlive(String pid)
Returns true if the process with the specified pid is alive.
|
protected void |
copyFile(org.apache.hadoop.fs.Path src,
org.apache.hadoop.fs.Path dst,
String owner) |
protected void |
createDir(org.apache.hadoop.fs.Path dirPath,
org.apache.hadoop.fs.permission.FsPermission perms,
boolean createParent,
String user) |
void |
deleteAsUser(DeletionAsUserContext ctx)
Delete specified directories as a given user.
|
protected org.apache.hadoop.fs.Path |
getWorkingDir(List<String> localDirs,
String user,
String appId) |
void |
init()
Run the executor initialization steps.
|
boolean |
isContainerAlive(ContainerLivenessContext ctx)
Check if a container is alive.
|
protected void |
killContainer(String pid,
ContainerExecutor.Signal signal)
Send a specified signal to the specified pid
|
int |
launchContainer(ContainerStartContext ctx)
Launch the container on the node.
|
boolean |
signalContainer(ContainerSignalContext ctx)
Signal container with the specified signal.
|
void |
startLocalizer(LocalizerStartContext ctx)
Prepare the environment for containers in this application to execute.
|
void |
writeLaunchEnv(OutputStream out,
Map<String,String> environment,
Map<org.apache.hadoop.fs.Path,List<String>> resources,
List<String> command,
org.apache.hadoop.fs.Path logDir)
This method writes out the launch environment of a container.
|
activateContainer, deactivateContainer, getConf, getNMEnvVar, getPidFilePath, getProcessId, getRunCommand, getRunCommand, isContainerActive, localizeClasspathJar, logOutput, reacquireContainer, setConf, updateEnvForWhitelistVars, writeLaunchEnv
public static final String DOCKER_CONTAINER_EXECUTOR_SCRIPT
public static final String DOCKER_CONTAINER_EXECUTOR_SESSION_SCRIPT
public static final String DOCKER_IMAGE_PATTERN
protected void copyFile(org.apache.hadoop.fs.Path src, org.apache.hadoop.fs.Path dst, String owner) throws IOException
IOException
public void init() throws IOException
ContainerExecutor
init
in class ContainerExecutor
IOException
public 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 ContainerExecutor
ctx
- LocalizerStartContext that encapsulates necessary information
for starting a localizer.IOException
- For most application init failuresInterruptedException
- If application init thread is halted by NMpublic int launchContainer(ContainerStartContext ctx) throws IOException
ContainerExecutor
launchContainer
in class ContainerExecutor
ctx
- Encapsulates information necessary for launching containers.IOException
public void writeLaunchEnv(OutputStream out, Map<String,String> environment, Map<org.apache.hadoop.fs.Path,List<String>> resources, List<String> command, org.apache.hadoop.fs.Path logDir) throws IOException
ContainerExecutor
writeLaunchEnv
in class ContainerExecutor
out
- the output stream to which the environment is written (usually
a script file which will be executed by the Launcher)environment
- The environment variables and their valuesresources
- The resources which have been localized for this container
Symlinks will be created to these localized resourcescommand
- The command that will be run.logDir
- The log dir to copy debugging information toIOException
- if any errors happened writing to the OutputStream,
while creating symlinkspublic boolean signalContainer(ContainerSignalContext ctx) throws IOException
ContainerExecutor
signalContainer
in class ContainerExecutor
ctx
- Encapsulates information necessary for signaling containers.IOException
public boolean isContainerAlive(ContainerLivenessContext ctx) throws IOException
ContainerExecutor
isContainerAlive
in class ContainerExecutor
ctx
- Encapsulates information necessary for container liveness check.IOException
public static boolean containerIsAlive(String pid) throws IOException
pid
- String pidIOException
protected void killContainer(String pid, ContainerExecutor.Signal signal) throws IOException
pid
- the pid of the process [group] to signal.signal
- signal to send
(for logging).IOException
public void deleteAsUser(DeletionAsUserContext ctx) throws IOException, InterruptedException
ContainerExecutor
deleteAsUser
in class ContainerExecutor
ctx
- Encapsulates information necessary for deletion.IOException
InterruptedException
protected void createDir(org.apache.hadoop.fs.Path dirPath, org.apache.hadoop.fs.permission.FsPermission perms, boolean createParent, String user) throws IOException
IOException
protected org.apache.hadoop.fs.Path getWorkingDir(List<String> localDirs, String user, String appId) throws IOException
IOException
Copyright © 2018 Apache Software Foundation. All Rights Reserved.