Class ContainerStatus

java.lang.Object
org.apache.hadoop.yarn.api.records.ContainerStatus

@Public @Stable public abstract class ContainerStatus extends Object
ContainerStatus represents the current status of a Container.

It provides details such as:

  • ContainerId of the container.
  • ExecutionType of the container.
  • ContainerState of the container.
  • Exit status of a completed container.
  • Diagnostic message for a failed container.
  • Resource allocated to the container.
  • Constructor Details

    • ContainerStatus

      public ContainerStatus()
  • Method Details

    • newInstance

      @Private @Unstable public static ContainerStatus newInstance(ContainerId containerId, ContainerState containerState, String diagnostics, int exitStatus)
    • newInstance

      @Private @Unstable public static ContainerStatus newInstance(ContainerId containerId, ExecutionType executionType, ContainerState containerState, String diagnostics, int exitStatus)
    • getContainerId

      @Public @Stable public abstract ContainerId getContainerId()
      Get the ContainerId of the container.
      Returns:
      ContainerId of the container
    • setContainerId

      @Private @Unstable public abstract void setContainerId(ContainerId containerId)
    • getExecutionType

      @Public @Evolving public ExecutionType getExecutionType()
      Get the ExecutionType of the container.
      Returns:
      ExecutionType of the container
    • setExecutionType

      @Private @Unstable public void setExecutionType(ExecutionType executionType)
    • getState

      @Public @Stable public abstract ContainerState getState()
      Get the ContainerState of the container.
      Returns:
      ContainerState of the container
    • setState

      @Private @Unstable public abstract void setState(ContainerState state)
    • getExitStatus

      @Public @Unstable public abstract int getExitStatus()

      Get the exit status for the container.

      Note: This is valid only for completed containers i.e. containers with state ContainerState.COMPLETE. Otherwise, it returns an ContainerExitStatus.INVALID.

      Containers killed by the framework, either due to being released by the application or being 'lost' due to node failures etc. have a special exit code of ContainerExitStatus.ABORTED.

      When threshold number of the nodemanager-local-directories or threshold number of the nodemanager-log-directories become bad, then container is not launched and is exited with ContainersExitStatus.DISKS_FAILED.

      Returns:
      exit status for the container
    • setExitStatus

      @Private @Unstable public abstract void setExitStatus(int exitStatus)
    • getDiagnostics

      @Public @Stable public abstract String getDiagnostics()
      Get diagnostic messages for failed containers.
      Returns:
      diagnostic messages for failed containers
    • setDiagnostics

      @Private @Unstable public abstract void setDiagnostics(String diagnostics)
    • getCapability

      @Public @Unstable public Resource getCapability()
      Get the Resource allocated to the container.
      Returns:
      Resource allocated to the container
    • setCapability

      @Private @Unstable public void setCapability(Resource capability)
    • getIPs

      @Public @Unstable public List<String> getIPs()
      Get all the IP addresses with which the container run.
      Returns:
      The IP address where the container runs.
    • setIPs

      @Private @Unstable public void setIPs(List<String> ips)
    • getHost

      @Public @Unstable public String getHost()
      Get the hostname where the container runs.
      Returns:
      The hostname where the container runs.
    • setHost

      @Private @Unstable public void setHost(String host)
    • setContainerSubState

      @Private @Unstable public void setContainerSubState(ContainerSubState subState)
      Add Extra state information of the container (SCHEDULED, LOCALIZING etc.).
      Parameters:
      subState - Extra State Information.
    • getContainerSubState

      @Private @Unstable public ContainerSubState getContainerSubState()
      Get Extra state information of the container (SCHEDULED, LOCALIZING etc.).
      Returns:
      Extra State information.
    • getExposedPorts

      @Public @Unstable public String getExposedPorts()
      Get exposed ports of the container.
      Returns:
      List of exposed ports
    • setExposedPorts

      @Private @Unstable public void setExposedPorts(String ports)