Class ContainerLaunch.ShellScriptBuilder

java.lang.Object
org.apache.hadoop.yarn.server.nodemanager.containermanager.launcher.ContainerLaunch.ShellScriptBuilder
Enclosing class:
ContainerLaunch

public abstract static class ContainerLaunch.ShellScriptBuilder extends Object
  • Field Details

  • Constructor Details

    • ShellScriptBuilder

      public ShellScriptBuilder()
  • Method Details

    • create

      public static ContainerLaunch.ShellScriptBuilder create()
    • create

      @VisibleForTesting public static ContainerLaunch.ShellScriptBuilder create(org.apache.hadoop.util.Shell.OSType osType)
    • command

      public abstract void command(List<String> command) throws IOException
      Throws:
      IOException
    • stdout

      public final void stdout(org.apache.hadoop.fs.Path stdoutDir, String stdOutFile) throws IOException
      Set stdout for the shell script
      Parameters:
      stdoutDir - stdout must be an absolute path
      stdOutFile - stdout file name
      Throws:
      IOException - thrown when stdout path is not absolute
    • stderr

      public final void stderr(org.apache.hadoop.fs.Path stderrDir, String stdErrFile) throws IOException
      Set stderr for the shell script
      Parameters:
      stderrDir - stderr must be an absolute path
      stdErrFile - stderr file name
      Throws:
      IOException - thrown when stderr path is not absolute
    • setStdOut

      protected abstract void setStdOut(org.apache.hadoop.fs.Path stdout) throws IOException
      Throws:
      IOException
    • setStdErr

      protected abstract void setStdErr(org.apache.hadoop.fs.Path stdout) throws IOException
      Throws:
      IOException
    • env

      public abstract void env(String key, String value) throws IOException
      Throws:
      IOException
    • whitelistedEnv

      public abstract void whitelistedEnv(String key, String value) throws IOException
      Throws:
      IOException
    • echo

      public abstract void echo(String echoStr) throws IOException
      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 file
      dst - path to the destination file - should be absolute
      Throws:
      IOException
    • listDebugInformation

      public abstract void listDebugInformation(org.apache.hadoop.fs.Path output) throws IOException
      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

      public String toString()
      Overrides:
      toString in class Object
    • write

      public final void write(PrintStream out) throws IOException
      Throws:
      IOException
    • buildCommand

      protected final void buildCommand(String... command)
    • linebreak

      protected final void linebreak(String... command)
    • line

      protected final void line(String... command)
    • 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

      protected abstract void mkdir(org.apache.hadoop.fs.Path path) throws IOException
      Throws:
      IOException
    • getEnvDependencies

      public Set<String> getEnvDependencies(String envVal)
      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

      public final Map<String,String> orderEnvByDependencies(Map<String,String> envs)
      Returns a dependency ordered version of envs. Does not alter input envs map.
      Parameters:
      envs - environment map
      Returns:
      a dependency ordered version of envs