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 |
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(String user,
org.apache.hadoop.fs.Path subDir,
org.apache.hadoop.fs.Path... baseDirs) |
protected org.apache.hadoop.fs.Path |
getWorkingDir(List<String> localDirs,
String user,
String appId) |
void |
init()
Run the executor initialization steps.
|
boolean |
isContainerProcessAlive(String user,
String pid) |
protected void |
killContainer(String pid,
ContainerExecutor.Signal signal)
Send a specified signal to the specified pid
|
int |
launchContainer(Container container,
org.apache.hadoop.fs.Path nmPrivateContainerScriptPath,
org.apache.hadoop.fs.Path nmPrivateTokensPath,
String userName,
String appId,
org.apache.hadoop.fs.Path containerWorkDir,
List<String> localDirs,
List<String> logDirs)
Launch the container on the node.
|
boolean |
signalContainer(String user,
String pid,
ContainerExecutor.Signal signal) |
void |
startLocalizer(org.apache.hadoop.fs.Path nmPrivateContainerTokensPath,
InetSocketAddress nmAddr,
String user,
String appId,
String locId,
LocalDirsHandlerService dirsHandler)
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) |
activateContainer, deactivateContainer, getConf, getPidFilePath, getProcessId, getRunCommand, getRunCommand, isContainerActive, localizeClasspathJar, logOutput, reacquireContainer, setConfpublic 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
IOExceptionpublic void init()
throws IOException
ContainerExecutorinit in class ContainerExecutorIOExceptionpublic void startLocalizer(org.apache.hadoop.fs.Path nmPrivateContainerTokensPath,
InetSocketAddress nmAddr,
String user,
String appId,
String locId,
LocalDirsHandlerService dirsHandler)
throws IOException,
InterruptedException
ContainerExecutorFor $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 ContainerExecutornmPrivateContainerTokensPath - path to localized credentials, rsrc by NMnmAddr - RPC address to contact NMuser - user name of application ownerappId - id of the applicationdirsHandler - NM local dirs service, for nm-local-dirs and nm-log-dirsIOException - For most application init failuresInterruptedException - If application init thread is halted by NMpublic int launchContainer(Container container, org.apache.hadoop.fs.Path nmPrivateContainerScriptPath, org.apache.hadoop.fs.Path nmPrivateTokensPath, String userName, String appId, org.apache.hadoop.fs.Path containerWorkDir, List<String> localDirs, List<String> logDirs) throws IOException
ContainerExecutorlaunchContainer in class ContainerExecutorcontainer - the container to be launchednmPrivateContainerScriptPath - the path for launch scriptnmPrivateTokensPath - the path for tokens for the containeruserName - the user of the containerappId - the appId of the containercontainerWorkDir - the work dir for the containerlocalDirs - nm-local-dirs to be used for this containerlogDirs - nm-log-dirs to be used for this containerIOExceptionpublic void writeLaunchEnv(OutputStream out, Map<String,String> environment, Map<org.apache.hadoop.fs.Path,List<String>> resources, List<String> command) throws IOException
writeLaunchEnv in class ContainerExecutorIOExceptionpublic boolean signalContainer(String user, String pid, ContainerExecutor.Signal signal) throws IOException
signalContainer in class ContainerExecutorIOExceptionpublic boolean isContainerProcessAlive(String user, String pid) throws IOException
isContainerProcessAlive in class ContainerExecutorIOExceptionpublic static boolean containerIsAlive(String pid) throws IOException
pid - String pidIOExceptionprotected void killContainer(String pid, ContainerExecutor.Signal signal) throws IOException
pid - the pid of the process [group] to signal.signal - signal to send
(for logging).IOExceptionpublic void deleteAsUser(String user, org.apache.hadoop.fs.Path subDir, org.apache.hadoop.fs.Path... baseDirs) throws IOException, InterruptedException
deleteAsUser in class ContainerExecutorIOExceptionInterruptedExceptionprotected void createDir(org.apache.hadoop.fs.Path dirPath,
org.apache.hadoop.fs.permission.FsPermission perms,
boolean createParent,
String user)
throws IOException
IOExceptionprotected org.apache.hadoop.fs.Path getWorkingDir(List<String> localDirs, String user, String appId) throws IOException
IOExceptionCopyright © 2016 Apache Software Foundation. All Rights Reserved.