Class ContainerLaunch.ShellScriptBuilder
java.lang.Object
org.apache.hadoop.yarn.server.nodemanager.containermanager.launcher.ContainerLaunch.ShellScriptBuilder
- Enclosing class:
- ContainerLaunch
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected final voidbuildCommand(String... command) abstract voidabstract voidcopyDebugInformation(org.apache.hadoop.fs.Path src, org.apache.hadoop.fs.Path dst) Method to copy files that are useful for debugging container failures.create()create(org.apache.hadoop.util.Shell.OSType osType) abstract voidabstract voidgetEnvDependencies(String envVal) Parse an environment value and returns all environment keys it uses.protected final voidprotected final voidprotected abstract voidlink(org.apache.hadoop.fs.Path src, org.apache.hadoop.fs.Path dst) abstract voidlistDebugInformation(org.apache.hadoop.fs.Path output) Method to dump debug information to a target file.protected abstract voidmkdir(org.apache.hadoop.fs.Path path) orderEnvByDependencies(Map<String, String> envs) Returns a dependency ordered version ofenvs.voidprotected abstract voidsetStdErr(org.apache.hadoop.fs.Path stdout) protected abstract voidsetStdOut(org.apache.hadoop.fs.Path stdout) final voidSet stderr for the shell scriptfinal voidSet stdout for the shell scriptfinal voidsymlink(org.apache.hadoop.fs.Path src, org.apache.hadoop.fs.Path dst) toString()abstract voidwhitelistedEnv(String key, String value) final voidwrite(PrintStream out)
-
Field Details
-
ENV_PRELAUNCH_STDOUT
- See Also:
-
ENV_PRELAUNCH_STDERR
- See Also:
-
-
Constructor Details
-
ShellScriptBuilder
public ShellScriptBuilder()
-
-
Method Details
-
create
-
create
@VisibleForTesting public static ContainerLaunch.ShellScriptBuilder create(org.apache.hadoop.util.Shell.OSType osType) -
command
- Throws:
IOException
-
stdout
Set stdout for the shell script- Parameters:
stdoutDir- stdout must be an absolute pathstdOutFile- stdout file name- Throws:
IOException- thrown when stdout path is not absolute
-
stderr
Set stderr for the shell script- Parameters:
stderrDir- stderr must be an absolute pathstdErrFile- stderr file name- Throws:
IOException- thrown when stderr path is not absolute
-
setStdOut
- Throws:
IOException
-
setStdErr
- Throws:
IOException
-
env
- Throws:
IOException
-
whitelistedEnv
- Throws:
IOException
-
echo
- Throws:
IOException
-
symlink
public final void symlink(org.apache.hadoop.fs.Path src, org.apache.hadoop.fs.Path dst) throws IOException - Throws:
IOException
-
copyDebugInformation
public abstract void copyDebugInformation(org.apache.hadoop.fs.Path src, org.apache.hadoop.fs.Path dst) throws IOException Method to copy files that are useful for debugging container failures. This method will be called by ContainerExecutor when setting up the container launch script. The method should take care to make sure files are read-able by the yarn user if the files are to undergo log-aggregation.- Parameters:
src- path to the source filedst- path to the destination file - should be absolute- Throws:
IOException
-
listDebugInformation
Method to dump debug information to a target file. This method will be called by ContainerExecutor when setting up the container launch script.- Parameters:
output- the file to which debug information is to be written- Throws:
IOException
-
toString
-
write
- Throws:
IOException
-
buildCommand
-
linebreak
-
line
-
setExitOnFailure
public void setExitOnFailure() -
link
protected abstract void link(org.apache.hadoop.fs.Path src, org.apache.hadoop.fs.Path dst) throws IOException - Throws:
IOException
-
mkdir
- Throws:
IOException
-
getEnvDependencies
Parse an environment value and returns all environment keys it uses.- Parameters:
envVal- an environment variable's value- Returns:
- all environment variable names used in
envVal.
-
orderEnvByDependencies
Returns a dependency ordered version ofenvs. Does not alter inputenvsmap.- Parameters:
envs- environment map- Returns:
- a dependency ordered version of
envs
-