Class AMRMClientAsync.AbstractCallbackHandler

java.lang.Object
org.apache.hadoop.yarn.client.api.async.AMRMClientAsync.AbstractCallbackHandler
All Implemented Interfaces:
AMRMClientAsync.CallbackHandler
Enclosing class:
AMRMClientAsync<T extends AMRMClient.ContainerRequest>

public abstract static class AMRMClientAsync.AbstractCallbackHandler extends Object implements AMRMClientAsync.CallbackHandler

The callback abstract class. The callback functions need to be implemented by AMRMClientAsync users. The APIs are called when responses from the ResourceManager are available.

  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    abstract float
     
    abstract void
    onContainersAllocated(List<org.apache.hadoop.yarn.api.records.Container> containers)
    Called when the ResourceManager responds to a heartbeat with allocated containers.
    abstract void
    onContainersCompleted(List<org.apache.hadoop.yarn.api.records.ContainerStatus> statuses)
    Called when the ResourceManager responds to a heartbeat with completed containers.
    void
    onContainersReceivedFromPreviousAttempts(List<org.apache.hadoop.yarn.api.records.Container> containers)
    Called when the ResourceManager responds to a heartbeat with containers from previous attempt.
    abstract void
    onContainersUpdated(List<org.apache.hadoop.yarn.api.records.UpdatedContainer> containers)
    Called when the ResourceManager responds to a heartbeat with containers whose resource allocation has been changed.
    abstract void
    Called when error comes from RM communications as well as from errors in the callback itself from the app.
    abstract void
    onNodesUpdated(List<org.apache.hadoop.yarn.api.records.NodeReport> updatedNodes)
    Called when nodes tracked by the ResourceManager have changed in health, availability etc.
    void
    onPreemptionMessageReceived(org.apache.hadoop.yarn.api.records.PreemptionMessage preemptionMessage)
    Called when the RM responds to a heartbeat with preemption message
    void
    onRequestsRejected(List<org.apache.hadoop.yarn.api.records.RejectedSchedulingRequest> rejectedSchedulingRequests)
    Called when the RM has rejected Scheduling Requests.
    abstract void
    Called when the ResourceManager wants the ApplicationMaster to shutdown for being out of sync etc.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • AbstractCallbackHandler

      public AbstractCallbackHandler()
  • Method Details

    • onContainersCompleted

      public abstract void onContainersCompleted(List<org.apache.hadoop.yarn.api.records.ContainerStatus> statuses)
      Called when the ResourceManager responds to a heartbeat with completed containers. If the response contains both completed containers and allocated containers, this will be called before containersAllocated.
      Specified by:
      onContainersCompleted in interface AMRMClientAsync.CallbackHandler
    • onContainersAllocated

      public abstract void onContainersAllocated(List<org.apache.hadoop.yarn.api.records.Container> containers)
      Called when the ResourceManager responds to a heartbeat with allocated containers. If the response containers both completed containers and allocated containers, this will be called after containersCompleted.
      Specified by:
      onContainersAllocated in interface AMRMClientAsync.CallbackHandler
    • onContainersUpdated

      @Public @Unstable public abstract void onContainersUpdated(List<org.apache.hadoop.yarn.api.records.UpdatedContainer> containers)
      Called when the ResourceManager responds to a heartbeat with containers whose resource allocation has been changed.
    • onShutdownRequest

      public abstract void onShutdownRequest()
      Called when the ResourceManager wants the ApplicationMaster to shutdown for being out of sync etc. The ApplicationMaster should not unregister with the RM unless the ApplicationMaster wants to be the last attempt.
      Specified by:
      onShutdownRequest in interface AMRMClientAsync.CallbackHandler
    • onNodesUpdated

      public abstract void onNodesUpdated(List<org.apache.hadoop.yarn.api.records.NodeReport> updatedNodes)
      Called when nodes tracked by the ResourceManager have changed in health, availability etc.
      Specified by:
      onNodesUpdated in interface AMRMClientAsync.CallbackHandler
    • getProgress

      public abstract float getProgress()
      Specified by:
      getProgress in interface AMRMClientAsync.CallbackHandler
    • onError

      public abstract void onError(Throwable e)
      Called when error comes from RM communications as well as from errors in the callback itself from the app. Calling stop() is the recommended action.
      Specified by:
      onError in interface AMRMClientAsync.CallbackHandler
    • onContainersReceivedFromPreviousAttempts

      public void onContainersReceivedFromPreviousAttempts(List<org.apache.hadoop.yarn.api.records.Container> containers)
      Called when the ResourceManager responds to a heartbeat with containers from previous attempt.
    • onRequestsRejected

      @Public @Unstable public void onRequestsRejected(List<org.apache.hadoop.yarn.api.records.RejectedSchedulingRequest> rejectedSchedulingRequests)
      Called when the RM has rejected Scheduling Requests.
      Parameters:
      rejectedSchedulingRequests - Rejected Scheduling Requests.
    • onPreemptionMessageReceived

      @Public @Unstable public void onPreemptionMessageReceived(org.apache.hadoop.yarn.api.records.PreemptionMessage preemptionMessage)
      Called when the RM responds to a heartbeat with preemption message
      Parameters:
      preemptionMessage -