Class ContainerLaunch
java.lang.Object
org.apache.hadoop.yarn.server.nodemanager.containermanager.launcher.ContainerLaunch
- Direct Known Subclasses:
ContainerRelaunch,RecoveredContainerLaunch,RecoverPausedContainerLaunch
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final Applicationprotected AtomicBooleanprotected final Containerstatic final Stringstatic final Stringstatic final Stringprotected AtomicBooleanprotected final LocalDirsHandlerServiceprotected final org.apache.hadoop.yarn.event.Dispatcherprotected final ContainerExecutorstatic final Stringstatic final Stringprotected org.apache.hadoop.fs.Pathprotected AtomicBooleanstatic final Stringstatic final String -
Constructor Summary
ConstructorsConstructorDescriptionContainerLaunch(Context context, org.apache.hadoop.conf.Configuration configuration, org.apache.hadoop.yarn.event.Dispatcher dispatcher, ContainerExecutor exec, Application app, Container container, LocalDirsHandlerService dirsHandler, ContainerManagerImpl containerManager) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddConfigsToEnv(Map<String, String> environment) There are some configurations (such as "yarn.nodemanager.admin-env") whose values need to be added to the environment variables.call()protected voidcleanupContainerFiles(org.apache.hadoop.fs.Path containerWorkDir) Clean up container's files for container relaunch or cleanup.static StringexpandEnvironment(String var, org.apache.hadoop.fs.Path containerLogDir) getApplicationLocalDirs(List<String> localDirs, String appIdStr) getContainerLocalDirs(List<String> localDirs) getContainerLogDirs(List<String> logDirs) protected StringgetContainerPrivateDir(String appIdStr, String containerIdStr) protected org.apache.hadoop.fs.Pathstatic StringgetExitCodeFile(String pidFile) getNMFilecacheDirs(List<String> localDirs) protected StringgetPidFileSubpath(String appIdStr, String containerIdStr) static StringgetRelativeContainerLogDir(String appIdStr, String containerIdStr) getUserFilecacheDirs(List<String> localDirs) getUserLocalDirs(List<String> localDirs) protected voidhandleContainerExitCode(int exitCode, org.apache.hadoop.fs.Path containerLogDir) protected voidhandleContainerExitWithFailure(org.apache.hadoop.yarn.api.records.ContainerId containerID, int ret, org.apache.hadoop.fs.Path containerLogDir, StringBuilder diagnosticInfo) Tries to tail and fetch TAIL_SIZE_IN_BYTES of data from the error log.protected intvoidPause the container.protected intprotected intvoidResume the container.voidsanitizeEnv(Map<String, String> environment, org.apache.hadoop.fs.Path pwd, List<org.apache.hadoop.fs.Path> appDirs, List<String> userLocalDirs, List<String> containerLogDirs, Map<org.apache.hadoop.fs.Path, List<String>> resources, org.apache.hadoop.fs.Path nmPrivateClasspathJarDir, Set<String> nmVars) protected voidsetContainerCompletedStatus(int exitCode) voidsignalContainer(org.apache.hadoop.yarn.api.records.SignalContainerCommand command) Send a signal to the container.static ContainerExecutor.SignaltranslateCommandToSignal(org.apache.hadoop.yarn.api.records.SignalContainerCommand command) protected boolean
-
Field Details
-
CONTAINER_PRE_LAUNCH_STDOUT
- See Also:
-
CONTAINER_PRE_LAUNCH_STDERR
- See Also:
-
CONTAINER_SCRIPT
-
FINAL_CONTAINER_TOKENS_FILE
- See Also:
-
SYSFS_DIR
- See Also:
-
KEYSTORE_FILE
- See Also:
-
TRUSTSTORE_FILE
- See Also:
-
dispatcher
protected final org.apache.hadoop.yarn.event.Dispatcher dispatcher -
exec
-
app
-
container
-
containerAlreadyLaunched
-
shouldPauseContainer
-
completed
-
pidFilePath
protected org.apache.hadoop.fs.Path pidFilePath -
dirsHandler
-
-
Constructor Details
-
ContainerLaunch
public ContainerLaunch(Context context, org.apache.hadoop.conf.Configuration configuration, org.apache.hadoop.yarn.event.Dispatcher dispatcher, ContainerExecutor exec, Application app, Container container, LocalDirsHandlerService dirsHandler, ContainerManagerImpl containerManager)
-
-
Method Details
-
expandEnvironment
-
call
-
validateContainerState
protected boolean validateContainerState() -
getContainerLogDirs
-
getContainerLocalDirs
-
getUserLocalDirs
-
getNMFilecacheDirs
-
getUserFilecacheDirs
-
getApplicationLocalDirs
-
getLocalizedResources
protected Map<org.apache.hadoop.fs.Path,List<String>> getLocalizedResources() throws org.apache.hadoop.yarn.exceptions.YarnException- Throws:
org.apache.hadoop.yarn.exceptions.YarnException
-
launchContainer
protected int launchContainer(ContainerStartContext ctx) throws IOException, org.apache.hadoop.yarn.exceptions.ConfigurationException - Throws:
IOExceptionorg.apache.hadoop.yarn.exceptions.ConfigurationException
-
relaunchContainer
protected int relaunchContainer(ContainerStartContext ctx) throws IOException, org.apache.hadoop.yarn.exceptions.ConfigurationException - Throws:
IOExceptionorg.apache.hadoop.yarn.exceptions.ConfigurationException
-
prepareForLaunch
- Throws:
IOException
-
setContainerCompletedStatus
protected void setContainerCompletedStatus(int exitCode) -
handleContainerExitCode
protected void handleContainerExitCode(int exitCode, org.apache.hadoop.fs.Path containerLogDir) -
handleContainerExitWithFailure
protected void handleContainerExitWithFailure(org.apache.hadoop.yarn.api.records.ContainerId containerID, int ret, org.apache.hadoop.fs.Path containerLogDir, StringBuilder diagnosticInfo) Tries to tail and fetch TAIL_SIZE_IN_BYTES of data from the error log. ErrorLog filename is not fixed and depends upon app, hence file name pattern is used.- Parameters:
containerID-ret-containerLogDir-diagnosticInfo-
-
getPidFileSubpath
-
signalContainer
public void signalContainer(org.apache.hadoop.yarn.api.records.SignalContainerCommand command) throws IOException Send a signal to the container.- Throws:
IOException
-
translateCommandToSignal
@VisibleForTesting public static ContainerExecutor.Signal translateCommandToSignal(org.apache.hadoop.yarn.api.records.SignalContainerCommand command) -
pauseContainer
Pause the container. Cancels the launch if the container isn't launched yet. Otherwise asks the executor to pause the container.- Throws:
IOException- in case of errors.
-
resumeContainer
Resume the container. Cancels the launch if the container isn't launched yet. Otherwise asks the executor to pause the container.- Throws:
IOException- in case of error.
-
getRelativeContainerLogDir
-
getContainerPrivateDir
-
sanitizeEnv
public void sanitizeEnv(Map<String, String> environment, org.apache.hadoop.fs.Path pwd, List<org.apache.hadoop.fs.Path> appDirs, List<String> userLocalDirs, List<String> containerLogDirs, Map<org.apache.hadoop.fs.Path, throws IOExceptionList<String>> resources, org.apache.hadoop.fs.Path nmPrivateClasspathJarDir, Set<String> nmVars) - Throws:
IOException
-
addConfigsToEnv
There are some configurations (such as "yarn.nodemanager.admin-env") whose values need to be added to the environment variables.- Parameters:
environment- The environment variables map to add the configuration values to.
-
getExitCodeFile
-
getContainerWorkDir
- Throws:
IOException
-
cleanupContainerFiles
protected void cleanupContainerFiles(org.apache.hadoop.fs.Path containerWorkDir) Clean up container's files for container relaunch or cleanup.
-