public abstract class ContainerExecutor extends Object implements org.apache.hadoop.conf.Configurable
Modifier and Type | Class and Description |
---|---|
static class |
ContainerExecutor.DelayedProcessKiller |
static class |
ContainerExecutor.ExitCode |
static class |
ContainerExecutor.Signal
The constants for the signals.
|
Modifier and Type | Field and Description |
---|---|
static org.apache.hadoop.fs.permission.FsPermission |
TASK_LAUNCH_SCRIPT_PERMISSION |
Constructor and Description |
---|
ContainerExecutor() |
Modifier and Type | Method and Description |
---|---|
void |
activateContainer(org.apache.hadoop.yarn.api.records.ContainerId containerId,
org.apache.hadoop.fs.Path pidFilePath)
Mark the container as active
|
void |
deactivateContainer(org.apache.hadoop.yarn.api.records.ContainerId containerId)
Mark the container as inactive.
|
abstract void |
deleteAsUser(String user,
org.apache.hadoop.fs.Path subDir,
org.apache.hadoop.fs.Path... basedirs) |
org.apache.hadoop.conf.Configuration |
getConf() |
protected org.apache.hadoop.fs.Path |
getPidFilePath(org.apache.hadoop.yarn.api.records.ContainerId containerId)
Get the pidFile of the container.
|
String |
getProcessId(org.apache.hadoop.yarn.api.records.ContainerId containerID)
Get the process-identifier for the container
|
protected String[] |
getRunCommand(String command,
String groupId,
String userName,
org.apache.hadoop.fs.Path pidFile,
org.apache.hadoop.conf.Configuration conf) |
protected String[] |
getRunCommand(String command,
String groupId,
String userName,
org.apache.hadoop.fs.Path pidFile,
org.apache.hadoop.conf.Configuration conf,
org.apache.hadoop.yarn.api.records.Resource resource)
Return a command to execute the given command in OS shell.
|
abstract void |
init()
Run the executor initialization steps.
|
protected boolean |
isContainerActive(org.apache.hadoop.yarn.api.records.ContainerId containerId)
Is the container still active?
|
abstract boolean |
isContainerProcessAlive(String user,
String pid) |
abstract int |
launchContainer(Container container,
org.apache.hadoop.fs.Path nmPrivateContainerScriptPath,
org.apache.hadoop.fs.Path nmPrivateTokensPath,
org.apache.hadoop.fs.Path nmPrivateExtTokensPath,
String extTokensEnvVar,
String user,
String appId,
org.apache.hadoop.fs.Path containerWorkDir,
List<String> localDirs,
List<String> logDirs)
Launch the container on the node.
|
org.apache.hadoop.fs.Path |
localizeClasspathJar(org.apache.hadoop.fs.Path classPathJar,
org.apache.hadoop.fs.Path pwd,
String owner)
On Windows the ContainerLaunch creates a temporary special jar manifest of
other jars to workaround the CLASSPATH length.
|
protected void |
logOutput(String output) |
int |
reacquireContainer(String user,
org.apache.hadoop.yarn.api.records.ContainerId containerId)
Recover an already existing container.
|
void |
setConf(org.apache.hadoop.conf.Configuration conf) |
abstract boolean |
signalContainer(String user,
String pid,
ContainerExecutor.Signal signal) |
abstract void |
startLocalizer(org.apache.hadoop.fs.Path nmPrivateContainerTokens,
org.apache.hadoop.fs.Path nmPrivateExtTokensPath,
String extTokensEnvVar,
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) |
public static final org.apache.hadoop.fs.permission.FsPermission TASK_LAUNCH_SCRIPT_PERMISSION
public void setConf(org.apache.hadoop.conf.Configuration conf)
setConf
in interface org.apache.hadoop.conf.Configurable
public org.apache.hadoop.conf.Configuration getConf()
getConf
in interface org.apache.hadoop.conf.Configurable
public abstract void init() throws IOException
IOException
public org.apache.hadoop.fs.Path localizeClasspathJar(org.apache.hadoop.fs.Path classPathJar, org.apache.hadoop.fs.Path pwd, String owner) throws IOException
classPathJar
- owner
- IOException
public abstract void startLocalizer(org.apache.hadoop.fs.Path nmPrivateContainerTokens, org.apache.hadoop.fs.Path nmPrivateExtTokensPath, String extTokensEnvVar, InetSocketAddress nmAddr, String user, String appId, String locId, LocalDirsHandlerService dirsHandler) throws IOException, InterruptedException
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
user
- user name of application ownerappId
- id of the applicationnmPrivateContainerTokens
- path to localized credentials, rsrc by NMnmPrivateExtTokensPath
- the path for any external tokens for the container - nullableextTokensEnvVar
- the name of the environment variable that points to external token path - nullablenmAddr
- RPC address to contact NMdirsHandler
- 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 abstract int launchContainer(Container container, org.apache.hadoop.fs.Path nmPrivateContainerScriptPath, org.apache.hadoop.fs.Path nmPrivateTokensPath, org.apache.hadoop.fs.Path nmPrivateExtTokensPath, String extTokensEnvVar, String user, String appId, org.apache.hadoop.fs.Path containerWorkDir, List<String> localDirs, List<String> logDirs) throws IOException
container
- the container to be launchednmPrivateContainerScriptPath
- the path for launch scriptnmPrivateTokensPath
- the path for tokens for the containernmPrivateExtTokensPath
- the path for any external tokens for the container - nullableextTokensEnvVar
- the name of the environment variable that points to external token path - nullableuser
- 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 containerIOException
public abstract boolean signalContainer(String user, String pid, ContainerExecutor.Signal signal) throws IOException
IOException
public abstract void deleteAsUser(String user, org.apache.hadoop.fs.Path subDir, org.apache.hadoop.fs.Path... basedirs) throws IOException, InterruptedException
IOException
InterruptedException
public abstract boolean isContainerProcessAlive(String user, String pid) throws IOException
IOException
public int reacquireContainer(String user, org.apache.hadoop.yarn.api.records.ContainerId containerId) throws IOException, InterruptedException
user
- the user of the containercontainerId
- The ID of the container to reacquireIOException
InterruptedException
public void writeLaunchEnv(OutputStream out, Map<String,String> environment, Map<org.apache.hadoop.fs.Path,List<String>> resources, List<String> command) throws IOException
IOException
protected void logOutput(String output)
protected org.apache.hadoop.fs.Path getPidFilePath(org.apache.hadoop.yarn.api.records.ContainerId containerId)
containerId
- protected String[] getRunCommand(String command, String groupId, String userName, org.apache.hadoop.fs.Path pidFile, org.apache.hadoop.conf.Configuration conf)
protected String[] getRunCommand(String command, String groupId, String userName, org.apache.hadoop.fs.Path pidFile, org.apache.hadoop.conf.Configuration conf, org.apache.hadoop.yarn.api.records.Resource resource)
protected boolean isContainerActive(org.apache.hadoop.yarn.api.records.ContainerId containerId)
containerId
- public void activateContainer(org.apache.hadoop.yarn.api.records.ContainerId containerId, org.apache.hadoop.fs.Path pidFilePath)
containerId
- the ContainerIdpidFilePath
- Path where the executor should write the pid of the launched
processpublic void deactivateContainer(org.apache.hadoop.yarn.api.records.ContainerId containerId)
public String getProcessId(org.apache.hadoop.yarn.api.records.ContainerId containerID)
containerID
- Copyright © 2015 Apache Software Foundation. All Rights Reserved.