Class AllocateResponse
java.lang.Object
org.apache.hadoop.yarn.api.protocolrecords.AllocateResponse
The response sent by the
ResourceManager the
ApplicationMaster during resource negotiation.
The response, includes:
- Response ID to track duplicate responses.
-
An AMCommand sent by ResourceManager to let the
ApplicationMastertake some actions (resync, shutdown etc.). - A list of newly allocated
Container. - A list of completed
Containers' statuses. - The available headroom for resources in the cluster for the application.
- A list of nodes whose status has been updated.
- The number of available nodes in a cluster.
- A description of resources requested back by the cluster
- AMRMToken, if AMRMToken has been rolled over
-
A list of
Containerrepresenting the containers whose resource has been increased. -
A list of
Containerrepresenting the containers whose resource has been decreased.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classClass to construct instances ofAllocateResponsewith specific options. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionGet the list of newly allocatedContainerby theResourceManager.abstract AMCommandIf theResourceManagerneeds theApplicationMasterto take some action then it will send an AMCommand to theApplicationMaster.abstract TokenThe AMRMToken that belong to this attemptabstract PriorityPriority of the applicationabstract ResourceGet the available headroom for resources in the cluster for the application.abstract CollectorInfoThe data associated with the collector that belongs to this app.abstract List<ContainerStatus>Get the list of completed containers' statuses.Get the list of running containers as viewed byResourceManagerfrom previous application attempts which have not been reported to the Application Master yet.abstract EnhancedHeadroomGet the list of NMTokens required for communicating with NM.abstract intGet the number of hosts available on the cluster.abstract PreemptionMessageGet the description of containers owned by the AM, but requested back by the cluster.Get a list of all SchedulingRequests that the RM has rejected between this allocate call and the previous one.abstract intGet the last response id.abstract List<UpdatedContainer>Get the list of newly updated containers byResourceManager.abstract List<NodeReport>Get the list of updatedNodeReports.Get the list of container update errors to inform the Application Master about the container updates that could not be satisfied due to error.static AllocateResponsenewInstance(int responseId, List<ContainerStatus> completedContainers, List<Container> allocatedContainers, List<NodeReport> updatedNodes, Resource availResources, AMCommand command, int numClusterNodes, PreemptionMessage preempt, List<NMToken> nmTokens) static AllocateResponsenewInstance(int responseId, List<ContainerStatus> completedContainers, List<Container> allocatedContainers, List<NodeReport> updatedNodes, Resource availResources, AMCommand command, int numClusterNodes, PreemptionMessage preempt, List<NMToken> nmTokens, CollectorInfo collectorInfo) static AllocateResponsenewInstance(int responseId, List<ContainerStatus> completedContainers, List<Container> allocatedContainers, List<NodeReport> updatedNodes, Resource availResources, AMCommand command, int numClusterNodes, PreemptionMessage preempt, List<NMToken> nmTokens, Token amRMToken, List<UpdatedContainer> updatedContainers) static AllocateResponsenewInstance(int responseId, List<ContainerStatus> completedContainers, List<Container> allocatedContainers, List<NodeReport> updatedNodes, Resource availResources, AMCommand command, int numClusterNodes, PreemptionMessage preempt, List<NMToken> nmTokens, Token amRMToken, List<UpdatedContainer> updatedContainers, CollectorInfo collectorInfo) static AllocateResponsenewInstance(int responseId, List<ContainerStatus> completedContainers, List<Container> allocatedContainers, List<NodeReport> updatedNodes, Resource availResources, AMCommand command, int numClusterNodes, PreemptionMessage preempt, List<NMToken> nmTokens, Token amRMToken, List<UpdatedContainer> updatedContainers, CollectorInfo collectorInfo, EnhancedHeadroom enhancedHeadroom) abstract voidsetAllocatedContainers(List<Container> containers) Set the list of newly allocatedContainerby theResourceManager.abstract voidsetAMCommand(AMCommand command) abstract voidsetAMRMToken(Token amRMToken) abstract voidsetApplicationPriority(Priority priority) abstract voidsetAvailableResources(Resource limit) abstract voidabstract voidsetCompletedContainersStatuses(List<ContainerStatus> containers) abstract voidsetContainersFromPreviousAttempts(List<Container> containersFromPreviousAttempt) Set the list of running containers as viewed byResourceManagerfrom previous application attempts which have not been reported to the Application Master yet.abstract voidsetEnhancedHeadroom(EnhancedHeadroom enhancedHeadroom) abstract voidsetNMTokens(List<NMToken> nmTokens) abstract voidsetNumClusterNodes(int numNodes) abstract voidsetPreemptionMessage(PreemptionMessage request) voidsetRejectedSchedulingRequests(List<RejectedSchedulingRequest> rejectedRequests) Add a list of rejected SchedulingRequests to the AllocateResponse.abstract voidsetResponseId(int responseId) abstract voidsetUpdatedContainers(List<UpdatedContainer> updatedContainers) Set the list of newly updated containers byResourceManager.abstract voidsetUpdatedNodes(List<NodeReport> updatedNodes) voidsetUpdateErrors(List<UpdateContainerError> updateErrors) Set the list of container update errors to inform the Application Master about the container updates that could not be satisfied due to error.
-
Constructor Details
-
AllocateResponse
public AllocateResponse()
-
-
Method Details
-
newInstance
@Public @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) -
newInstance
@Private @Unstable 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, CollectorInfo collectorInfo) -
newInstance
@Private @Unstable 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, Token amRMToken, List<UpdatedContainer> updatedContainers) -
newInstance
@Public @Unstable 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, Token amRMToken, List<UpdatedContainer> updatedContainers, CollectorInfo collectorInfo) -
newInstance
@Private @Unstable 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, Token amRMToken, List<UpdatedContainer> updatedContainers, CollectorInfo collectorInfo, EnhancedHeadroom enhancedHeadroom) -
getAMCommand
If theResourceManagerneeds theApplicationMasterto take some action then it will send an AMCommand to theApplicationMaster. SeeAMCommandfor details on commands and actions for them.- Returns:
AMCommandif theApplicationMastershould take action,nullotherwise- See Also:
-
setAMCommand
-
getResponseId
@Public @Stable public abstract int getResponseId()Get the last response id.- Returns:
- last response id
-
setResponseId
@Private @Unstable public abstract void setResponseId(int responseId) -
getAllocatedContainers
Get the list of newly allocatedContainerby theResourceManager.- Returns:
- list of newly allocated
Container
-
setAllocatedContainers
Set the list of newly allocatedContainerby theResourceManager.- Parameters:
containers- list of newly allocatedContainer
-
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
-
getCompletedContainersStatuses
Get the list of completed containers' statuses.- Returns:
- the list of completed containers' statuses
-
setCompletedContainersStatuses
@Private @Unstable public abstract void setCompletedContainersStatuses(List<ContainerStatus> containers) -
getUpdatedNodes
Get the list of updatedNodeReports. Updates could be changes in health, availability etc of the nodes.- Returns:
- The delta of updated nodes since the last response
-
setUpdatedNodes
-
getNumClusterNodes
@Public @Stable public abstract int getNumClusterNodes()Get the number of hosts available on the cluster.- Returns:
- the available host count.
-
setNumClusterNodes
@Private @Unstable public abstract void setNumClusterNodes(int numNodes) -
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
-
getNMTokens
Get the list of NMTokens required for communicating with NM. New NMTokens issued only if1) 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.
- Returns:
- list of NMTokens required for communicating with NM
-
setNMTokens
-
getUpdatedContainers
Get the list of newly updated containers byResourceManager.- Returns:
- list of newly increased containers
-
setUpdatedContainers
@Private @Unstable public abstract void setUpdatedContainers(List<UpdatedContainer> updatedContainers) Set the list of newly updated containers byResourceManager.- Parameters:
updatedContainers- List of Updated Containers.
-
getAMRMToken
The AMRMToken that belong to this attempt- Returns:
- The AMRMToken that belong to this attempt
-
setAMRMToken
-
getApplicationPriority
Priority of the application- Returns:
- get application priority
-
setApplicationPriority
-
getCollectorInfo
The data associated with the collector that belongs to this app. Contains address and token alongwith identification information.- Returns:
- The data of collector that belong to this attempt
-
setCollectorInfo
-
getUpdateErrors
Get the list of container update errors to inform the Application Master about the container updates that could not be satisfied due to error.- Returns:
- List of Update Container Errors.
-
setUpdateErrors
Set the list of container update errors to inform the Application Master about the container updates that could not be satisfied due to error.- Parameters:
updateErrors- list ofUpdateContainerErrorfor containers updates requests that were in error
-
getContainersFromPreviousAttempts
Get the list of running containers as viewed byResourceManagerfrom previous application attempts which have not been reported to the Application Master yet.
These containers were recovered by the RM after the application master had already registered. This may happen after RM restart when some NMs get delayed in connecting to the RM and reporting the active containers. Since they were not reported in the registration response, they are reported in the response to the AM heartbeat.- Returns:
- the list of running containers as viewed by
ResourceManagerfrom previous application attempts.
-
setContainersFromPreviousAttempts
@Private @Unstable public abstract void setContainersFromPreviousAttempts(List<Container> containersFromPreviousAttempt) Set the list of running containers as viewed byResourceManagerfrom previous application attempts which have not been reported to the Application Master yet.
These containers were recovered by the RM after the application master had already registered. This may happen after RM restart when some NMs get delayed in connecting to the RM and reporting the active containers. Since they were not reported in the registration response, they are reported in the response to the AM heartbeat.- Parameters:
containersFromPreviousAttempt- the list of running containers as viewed byResourceManagerfrom previous application attempts.
-
getRejectedSchedulingRequests
Get a list of all SchedulingRequests that the RM has rejected between this allocate call and the previous one.- Returns:
- List of RejectedSchedulingRequests.
-
setRejectedSchedulingRequests
@Private @Unstable public void setRejectedSchedulingRequests(List<RejectedSchedulingRequest> rejectedRequests) Add a list of rejected SchedulingRequests to the AllocateResponse.- Parameters:
rejectedRequests- List of Rejected Scheduling Requests.
-
newBuilder
-
getEnhancedHeadroom
-
setEnhancedHeadroom
-