public class DefaultContainerExecutor extends ContainerExecutor
| Modifier and Type | Class and Description |
|---|---|
protected class |
DefaultContainerExecutor.LocalWrapperScriptBuilder |
ContainerExecutor.DelayedProcessKiller, ContainerExecutor.ExitCode, ContainerExecutor.Signal| Modifier and Type | Field and Description |
|---|---|
protected org.apache.hadoop.fs.FileContext |
lfs |
DIRECTORY_CONTENTS, TASK_LAUNCH_SCRIPT_PERMISSION| Constructor and Description |
|---|
DefaultContainerExecutor() |
| Modifier and Type | Method and Description |
|---|---|
protected org.apache.hadoop.util.Shell.CommandExecutor |
buildCommandExecutor(String wrapperScriptPath,
String containerIdStr,
String user,
org.apache.hadoop.fs.Path pidFile,
org.apache.hadoop.yarn.api.records.Resource resource,
File wordDir,
Map<String,String> environment) |
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 ContainerLocalizer |
createContainerLocalizer(String user,
String appId,
String locId,
List<String> localDirs,
org.apache.hadoop.fs.FileContext localizerFc) |
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 DefaultContainerExecutor.LocalWrapperScriptBuilder |
getLocalWrapperScriptBuilder(String containerIdStr,
org.apache.hadoop.fs.Path containerWorkDir) |
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.
|
protected void |
setScriptExecutable(org.apache.hadoop.fs.Path script,
String owner) |
boolean |
signalContainer(ContainerSignalContext ctx)
Signal container with the specified signal.
|
void |
startLocalizer(LocalizerStartContext ctx)
Prepare the environment for containers in this application to execute.
|
activateContainer, deactivateContainer, getConf, getPidFilePath, getProcessId, getRunCommand, getRunCommand, isContainerActive, localizeClasspathJar, logOutput, reacquireContainer, setConf, writeLaunchEnv, writeLaunchEnvprotected void copyFile(org.apache.hadoop.fs.Path src,
org.apache.hadoop.fs.Path dst,
String owner)
throws IOException
IOExceptionprotected void setScriptExecutable(org.apache.hadoop.fs.Path script,
String owner)
throws IOException
IOExceptionpublic void init()
throws IOException
ContainerExecutorinit in class ContainerExecutorIOExceptionpublic void startLocalizer(LocalizerStartContext ctx) 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 ContainerExecutorctx - LocalizerStartContext that encapsulates necessary information
for starting a localizer.IOException - For most application init failuresInterruptedException - If application init thread is halted by NM@InterfaceAudience.Private protected ContainerLocalizer createContainerLocalizer(String user, String appId, String locId, List<String> localDirs, org.apache.hadoop.fs.FileContext localizerFc) throws IOException
IOExceptionpublic int launchContainer(ContainerStartContext ctx) throws IOException
ContainerExecutorlaunchContainer in class ContainerExecutorctx - Encapsulates information necessary for launching containers.IOExceptionprotected org.apache.hadoop.util.Shell.CommandExecutor buildCommandExecutor(String wrapperScriptPath, String containerIdStr, String user, org.apache.hadoop.fs.Path pidFile, org.apache.hadoop.yarn.api.records.Resource resource, File wordDir, Map<String,String> environment) throws IOException
IOExceptionprotected DefaultContainerExecutor.LocalWrapperScriptBuilder getLocalWrapperScriptBuilder(String containerIdStr, org.apache.hadoop.fs.Path containerWorkDir)
public boolean signalContainer(ContainerSignalContext ctx) throws IOException
ContainerExecutorsignalContainer in class ContainerExecutorctx - Encapsulates information necessary for signaling containers.IOExceptionpublic boolean isContainerAlive(ContainerLivenessContext ctx) throws IOException
ContainerExecutorisContainerAlive in class ContainerExecutorctx - Encapsulates information necessary for container liveness check.IOExceptionpublic 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(DeletionAsUserContext ctx) throws IOException, InterruptedException
ContainerExecutordeleteAsUser in class ContainerExecutorctx - Encapsulates information necessary for deletion.IOExceptionInterruptedExceptionprotected org.apache.hadoop.fs.Path getWorkingDir(List<String> localDirs, String user, String appId) throws IOException
IOExceptionprotected void createDir(org.apache.hadoop.fs.Path dirPath,
org.apache.hadoop.fs.permission.FsPermission perms,
boolean createParent,
String user)
throws IOException
IOExceptionCopyright © 2017 Apache Software Foundation. All Rights Reserved.