org.apache.hadoop.yarn.api.protocolrecords
Class AllocateResponse

java.lang.Object
  extended by org.apache.hadoop.yarn.api.protocolrecords.AllocateResponse

@InterfaceAudience.Public
@InterfaceStability.Stable
public abstract class AllocateResponse
extends Object

The response sent by the ResourceManager the ApplicationMaster during resource negotiation.

The response, includes:

See Also:
ApplicationMasterProtocol.allocate(AllocateRequest)

Constructor Summary
AllocateResponse()
           
 
Method Summary
abstract  List<Container> getAllocatedContainers()
          Get the list of newly allocated Container by the ResourceManager.
abstract  AMCommand getAMCommand()
          If the ResourceManager needs the ApplicationMaster to take some action then it will send an AMCommand to the ApplicationMaster.
abstract  Resource getAvailableResources()
          Get the available headroom for resources in the cluster for the application.
abstract  List<ContainerStatus> getCompletedContainersStatuses()
          Get the list of completed containers' statuses.
abstract  List<NMToken> getNMTokens()
          Get the list of NMTokens required for communicating with NM.
abstract  int getNumClusterNodes()
          Get the number of hosts available on the cluster.
abstract  PreemptionMessage getPreemptionMessage()
          Get the description of containers owned by the AM, but requested back by the cluster.
abstract  int getResponseId()
          Get the last response id.
abstract  List<NodeReport> getUpdatedNodes()
          Get the list of updated NodeReports.
static AllocateResponse newInstance(int responseId, List<ContainerStatus> completedContainers, List<Container> allocatedContainers, List<NodeReport> updatedNodes, Resource availResources, AMCommand command, int numClusterNodes, PreemptionMessage preempt, List<NMToken> nmTokens)
           
abstract  void setAllocatedContainers(List<Container> containers)
          Set the list of newly allocated Container by the ResourceManager.
abstract  void setAMCommand(AMCommand command)
           
abstract  void setAvailableResources(Resource limit)
           
abstract  void setCompletedContainersStatuses(List<ContainerStatus> containers)
           
abstract  void setNMTokens(List<NMToken> nmTokens)
           
abstract  void setNumClusterNodes(int numNodes)
           
abstract  void setPreemptionMessage(PreemptionMessage request)
           
abstract  void setResponseId(int responseId)
           
abstract  void setUpdatedNodes(List<NodeReport> updatedNodes)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AllocateResponse

public AllocateResponse()
Method Detail

newInstance

@InterfaceAudience.Public
@InterfaceStability.Stable
public static AllocateResponse newInstance(int responseId,
                                                                                              List<ContainerStatus> completedContainers,
                                                                                              List<Container> allocatedContainers,
                                                                                              List<NodeReport> updatedNodes,
                                                                                              Resource availResources,
                                                                                              AMCommand command,
                                                                                              int numClusterNodes,
                                                                                              PreemptionMessage preempt,
                                                                                              List<NMToken> nmTokens)

getAMCommand

@InterfaceAudience.Public
@InterfaceStability.Stable
public abstract AMCommand getAMCommand()
If the ResourceManager needs the ApplicationMaster to take some action then it will send an AMCommand to the ApplicationMaster. See AMCommand for details on commands and actions for them.

Returns:
AMCommand if the ApplicationMaster should take action, null otherwise
See Also:
AMCommand

setAMCommand

@InterfaceAudience.Private
@InterfaceStability.Unstable
public abstract void setAMCommand(AMCommand command)

getResponseId

@InterfaceAudience.Public
@InterfaceStability.Stable
public abstract int getResponseId()
Get the last response id.

Returns:
last response id

setResponseId

@InterfaceAudience.Private
@InterfaceStability.Unstable
public abstract void setResponseId(int responseId)

getAllocatedContainers

@InterfaceAudience.Public
@InterfaceStability.Stable
public abstract List<Container> getAllocatedContainers()
Get the list of newly allocated Container by the ResourceManager.

Returns:
list of newly allocated Container

setAllocatedContainers

@InterfaceAudience.Private
@InterfaceStability.Unstable
public abstract void setAllocatedContainers(List<Container> containers)
Set the list of newly allocated Container by the ResourceManager.

Parameters:
containers - list of newly allocated Container

getAvailableResources

@InterfaceAudience.Public
@InterfaceStability.Stable
public abstract Resource getAvailableResources()
Get the available headroom for resources in the cluster for the application.

Returns:
limit of available headroom for resources in the cluster for the application

setAvailableResources

@InterfaceAudience.Private
@InterfaceStability.Unstable
public abstract void setAvailableResources(Resource limit)

getCompletedContainersStatuses

@InterfaceAudience.Public
@InterfaceStability.Stable
public abstract List<ContainerStatus> getCompletedContainersStatuses()
Get the list of completed containers' statuses.

Returns:
the list of completed containers' statuses

setCompletedContainersStatuses

@InterfaceAudience.Private
@InterfaceStability.Unstable
public abstract void setCompletedContainersStatuses(List<ContainerStatus> containers)

getUpdatedNodes

@InterfaceAudience.Public
@InterfaceStability.Stable
public abstract List<NodeReport> getUpdatedNodes()
Get the list of updated NodeReports. Updates could be changes in health, availability etc of the nodes.

Returns:
The delta of updated nodes since the last response

setUpdatedNodes

@InterfaceAudience.Private
@InterfaceStability.Unstable
public abstract void setUpdatedNodes(List<NodeReport> updatedNodes)

getNumClusterNodes

@InterfaceAudience.Public
@InterfaceStability.Stable
public abstract int getNumClusterNodes()
Get the number of hosts available on the cluster.

Returns:
the available host count.

setNumClusterNodes

@InterfaceAudience.Private
@InterfaceStability.Unstable
public abstract void setNumClusterNodes(int numNodes)

getPreemptionMessage

@InterfaceAudience.Public
@InterfaceStability.Evolving
public abstract PreemptionMessage getPreemptionMessage()

Get the description of containers owned by the AM, but requested back by the cluster. Note that the RM may have an inconsistent view of the resources owned by the AM. These messages are advisory, and the AM may elect to ignore them.

The message is a snapshot of the resources the RM wants back from the AM. While demand persists, the RM will repeat its request; applications should not interpret each message as a request for additional resources on top of previous messages. Resources requested consistently over some duration may be forcibly killed by the RM.

Returns:
A specification of the resources to reclaim from this AM.

setPreemptionMessage

@InterfaceAudience.Private
@InterfaceStability.Unstable
public abstract void setPreemptionMessage(PreemptionMessage request)

getNMTokens

@InterfaceAudience.Public
@InterfaceStability.Stable
public abstract List<NMToken> getNMTokens()

Get the list of NMTokens required for communicating with NM. New NMTokens issued only if

1) AM is receiving first container on underlying NodeManager.
OR
2) NMToken master key rolled over in ResourceManager and AM is getting new container on the same underlying NodeManager.

AM will receive one NMToken per NM irrespective of the number of containers issued on same NM. AM is expected to store these tokens until issued a new token for the same NM.


setNMTokens

@InterfaceAudience.Private
@InterfaceStability.Unstable
public abstract void setNMTokens(List<NMToken> nmTokens)


Copyright © 2014 Apache Software Foundation. All Rights Reserved.