public abstract class ContainerExecutor extends Object implements 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 FsPermission |
TASK_LAUNCH_SCRIPT_PERMISSION |
Constructor and Description |
---|
ContainerExecutor() |
Modifier and Type | Method and Description |
---|---|
void |
activateContainer(ContainerId containerId,
Path pidFilePath)
Mark the container as active
|
void |
deactivateContainer(ContainerId containerId)
Mark the container as inactive.
|
abstract void |
deleteAsUser(String user,
Path subDir,
Path... basedirs) |
Configuration |
getConf()
Return the configuration used by this object.
|
protected Path |
getPidFilePath(ContainerId containerId)
Get the pidFile of the container.
|
String |
getProcessId(ContainerId containerID)
Get the process-identifier for the container
|
protected static String[] |
getRunCommand(String command,
String groupId,
Configuration conf)
Return a command to execute the given command in OS shell.
|
abstract void |
init()
Run the executor initialization steps.
|
protected boolean |
isContainerActive(ContainerId containerId)
Is the container still active?
|
abstract int |
launchContainer(Container container,
Path nmPrivateContainerScriptPath,
Path nmPrivateTokensPath,
String user,
String appId,
Path containerWorkDir,
List<String> localDirs,
List<String> logDirs)
Launch the container on the node.
|
protected void |
logOutput(String output) |
void |
setConf(Configuration conf)
Set the configuration to be used by this object.
|
abstract boolean |
signalContainer(String user,
String pid,
ContainerExecutor.Signal signal) |
abstract void |
startLocalizer(Path nmPrivateContainerTokens,
InetSocketAddress nmAddr,
String user,
String appId,
String locId,
List<String> localDirs,
List<String> logDirs)
Prepare the environment for containers in this application to execute.
|
public static final FsPermission TASK_LAUNCH_SCRIPT_PERMISSION
public void setConf(Configuration conf)
Configurable
setConf
in interface Configurable
public Configuration getConf()
Configurable
getConf
in interface Configurable
public abstract void init() throws IOException
IOException
public abstract void startLocalizer(Path nmPrivateContainerTokens, InetSocketAddress nmAddr, String user, String appId, String locId, List<String> localDirs, List<String> logDirs) throws IOException, InterruptedException
user
- user name of application ownerappId
- id of the applicationnmPrivateContainerTokens
- path to localized credentials, rsrc by NMnmAddr
- RPC address to contact NMlocalDirs
- nm-local-dirslogDirs
- nm-log-dirsIOException
- For most application init failuresInterruptedException
- If application init thread is halted by NMpublic abstract int launchContainer(Container container, Path nmPrivateContainerScriptPath, Path nmPrivateTokensPath, String user, String appId, 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 containeruser
- 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, Path subDir, Path... basedirs) throws IOException, InterruptedException
IOException
InterruptedException
protected void logOutput(String output)
protected Path getPidFilePath(ContainerId containerId)
containerId
- protected static String[] getRunCommand(String command, String groupId, Configuration conf)
protected boolean isContainerActive(ContainerId containerId)
containerId
- public void activateContainer(ContainerId containerId, Path pidFilePath)
containerId
- the ContainerIdpidFilePath
- Path where the executor should write the pid of the launched
processpublic void deactivateContainer(ContainerId containerId)
public String getProcessId(ContainerId containerID)
containerID
- Copyright © 2013 Apache Software Foundation. All rights reserved.