Class AppSchedulingInfo
java.lang.Object
org.apache.hadoop.yarn.server.resourcemanager.scheduler.AppSchedulingInfo
This class keeps track of all the consumption of an application. This also
keeps track of current running/completed containers for the application.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionAppSchedulingInfo(org.apache.hadoop.yarn.api.records.ApplicationAttemptId appAttemptId, String user, Queue queue, AbstractUsersManager abstractUsersManager, long epoch, ResourceUsage appResourceUsage, Map<String, String> applicationSchedulingEnvs, RMContext rmContext, boolean unmanagedAM) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddRequestedPartition(String partition) allocate(NodeType type, SchedulerNode node, org.apache.hadoop.yarn.server.scheduler.SchedulerRequestKey schedulerKey, RMContainer containerAllocated) booleancanDelayTo(org.apache.hadoop.yarn.server.scheduler.SchedulerRequestKey schedulerKey, String resourceName) Can delay to next?.booleancheckAllocation(NodeType type, SchedulerNode node, org.apache.hadoop.yarn.server.scheduler.SchedulerRequestKey schedulerKey) voidvoiddecPendingResource(String partition, org.apache.hadoop.yarn.api.records.Resource toDecrease) List<org.apache.hadoop.yarn.api.records.ResourceRequest>Used by REST API to fetch ResourceRequestList<org.apache.hadoop.yarn.api.records.SchedulingRequest>Fetch SchedulingRequests.booleanorg.apache.hadoop.yarn.api.records.ApplicationAttemptIdorg.apache.hadoop.yarn.api.records.ApplicationIdGet scheduling envs configured for this application.<N extends SchedulerNode>
AppPlacementAllocator<N>getAppPlacementAllocator(org.apache.hadoop.yarn.server.scheduler.SchedulerRequestKey schedulerkey) Get the defaultNodeLabelExpression for the application's current queue.Set default App Placement Allocator.longgetPendingAsk(org.apache.hadoop.yarn.server.scheduler.SchedulerRequestKey schedulerKey) getPendingAsk(org.apache.hadoop.yarn.server.scheduler.SchedulerRequestKey schedulerKey, String resourceName) List<org.apache.hadoop.yarn.api.records.RejectedSchedulingRequest>Collection<org.apache.hadoop.yarn.server.scheduler.SchedulerRequestKey>getUser()booleanbooleanisPlaceBlacklisted(String resourceName, boolean blacklistedBySystem) Returns if the place (node/rack today) is either blacklisted by the application (user) or the system.booleanvoidbooleanprecheckNode(org.apache.hadoop.yarn.server.scheduler.SchedulerRequestKey schedulerKey, SchedulerNode schedulerNode, SchedulingMode schedulingMode, Optional<DiagnosticsCollector> dcOpt) Pre-check node to see if it satisfy the given schedulerKey and scheduler mode.voidrecoverContainer(RMContainer rmContainer, String partition) voidremoveAppPlacement(org.apache.hadoop.yarn.server.scheduler.SchedulerRequestKey schedulerRequestKey) voidvoidsetUnmanagedAM(boolean unmanagedAM) voidstop()voidstatic voidupdateMetrics(org.apache.hadoop.yarn.api.records.ApplicationId applicationId, NodeType type, SchedulerNode node, RMContainer containerAllocated, String user, Queue queue) voidupdatePlacesBlacklistedByApp(List<String> blacklistAdditions, List<String> blacklistRemovals) The ApplicationMaster is updating the placesBlacklistedByApp used for containers other than AMs.voidupdatePlacesBlacklistedBySystem(List<String> blacklistAdditions, List<String> blacklistRemovals) Update the list of places that are blacklisted by the system.booleanupdateResourceRequests(List<org.apache.hadoop.yarn.api.records.ResourceRequest> resourceRequests, boolean recoverPreemptedRequestForAContainer) The ApplicationMaster is updating resource requirements for the application, by asking for more resources and releasing resources acquired by the application.booleanupdateResourceRequests(Map<org.apache.hadoop.yarn.server.scheduler.SchedulerRequestKey, Map<String, org.apache.hadoop.yarn.api.records.ResourceRequest>> dedupRequests, boolean recoverPreemptedRequestForAContainer) The ApplicationMaster is updating resource requirements for the application, by asking for more resources and releasing resources acquired by the application.booleanupdateSchedulingRequests(List<org.apache.hadoop.yarn.api.records.SchedulingRequest> schedulingRequests, boolean recoverPreemptedRequestForAContainer) The ApplicationMaster is updating resource requirements for the application, by asking for more resources and releasing resources acquired by the application.
-
Field Details
-
updateContext
-
-
Constructor Details
-
AppSchedulingInfo
public AppSchedulingInfo(org.apache.hadoop.yarn.api.records.ApplicationAttemptId appAttemptId, String user, Queue queue, AbstractUsersManager abstractUsersManager, long epoch, ResourceUsage appResourceUsage, Map<String, String> applicationSchedulingEnvs, RMContext rmContext, boolean unmanagedAM)
-
-
Method Details
-
getDefaultResourceRequestAppPlacementType
Set default App Placement Allocator.- Returns:
- app placement class.
-
getApplicationId
public org.apache.hadoop.yarn.api.records.ApplicationId getApplicationId() -
getApplicationAttemptId
public org.apache.hadoop.yarn.api.records.ApplicationAttemptId getApplicationAttemptId() -
getUser
-
getNewContainerId
public long getNewContainerId() -
getQueueName
-
isPending
public boolean isPending() -
setUnmanagedAM
public void setUnmanagedAM(boolean unmanagedAM) -
isUnmanagedAM
public boolean isUnmanagedAM() -
getRequestedPartitions
-
getUpdateContext
-
updateResourceRequests
public boolean updateResourceRequests(List<org.apache.hadoop.yarn.api.records.ResourceRequest> resourceRequests, boolean recoverPreemptedRequestForAContainer) The ApplicationMaster is updating resource requirements for the application, by asking for more resources and releasing resources acquired by the application.- Parameters:
resourceRequests- resource requests to be allocatedrecoverPreemptedRequestForAContainer- recover ResourceRequest/SchedulingRequest on preemption- Returns:
- true if any resource was updated, false otherwise
-
updateResourceRequests
public boolean updateResourceRequests(Map<org.apache.hadoop.yarn.server.scheduler.SchedulerRequestKey, Map<String, org.apache.hadoop.yarn.api.records.ResourceRequest>> dedupRequests, boolean recoverPreemptedRequestForAContainer) The ApplicationMaster is updating resource requirements for the application, by asking for more resources and releasing resources acquired by the application.- Parameters:
dedupRequests- (dedup) resource requests to be allocatedrecoverPreemptedRequestForAContainer- recover ResourceRequest/SchedulingRequest on preemption- Returns:
- true if any resource was updated, false otherwise
-
updateSchedulingRequests
public boolean updateSchedulingRequests(List<org.apache.hadoop.yarn.api.records.SchedulingRequest> schedulingRequests, boolean recoverPreemptedRequestForAContainer) The ApplicationMaster is updating resource requirements for the application, by asking for more resources and releasing resources acquired by the application.- Parameters:
schedulingRequests- resource requests to be allocatedrecoverPreemptedRequestForAContainer- recover ResourceRequest/SchedulingRequest on preemption- Returns:
- true if any resource was updated, false otherwise
-
removeAppPlacement
public void removeAppPlacement(org.apache.hadoop.yarn.server.scheduler.SchedulerRequestKey schedulerRequestKey) -
addRequestedPartition
-
decPendingResource
public void decPendingResource(String partition, org.apache.hadoop.yarn.api.records.Resource toDecrease) -
updatePlacesBlacklistedByApp
public void updatePlacesBlacklistedByApp(List<String> blacklistAdditions, List<String> blacklistRemovals) The ApplicationMaster is updating the placesBlacklistedByApp used for containers other than AMs.- Parameters:
blacklistAdditions- resources to be added to the userBlacklistblacklistRemovals- resources to be removed from the userBlacklist
-
updatePlacesBlacklistedBySystem
public void updatePlacesBlacklistedBySystem(List<String> blacklistAdditions, List<String> blacklistRemovals) Update the list of places that are blacklisted by the system. Today the system only blacklists places when it sees that AMs failed there- Parameters:
blacklistAdditions- resources to be added to placesBlacklistedBySystemblacklistRemovals- resources to be removed from placesBlacklistedBySystem
-
getAndResetBlacklistChanged
public boolean getAndResetBlacklistChanged() -
getSchedulerKeys
-
getAllResourceRequests
Used by REST API to fetch ResourceRequest- Returns:
- All pending ResourceRequests.
-
getAllSchedulingRequests
Fetch SchedulingRequests.- Returns:
- All pending SchedulingRequests.
-
getRejectedRequest
-
getNextPendingAsk
-
getPendingAsk
public PendingAsk getPendingAsk(org.apache.hadoop.yarn.server.scheduler.SchedulerRequestKey schedulerKey) -
getPendingAsk
public PendingAsk getPendingAsk(org.apache.hadoop.yarn.server.scheduler.SchedulerRequestKey schedulerKey, String resourceName) -
isPlaceBlacklisted
Returns if the place (node/rack today) is either blacklisted by the application (user) or the system.- Parameters:
resourceName- the resourcenameblacklistedBySystem- true if it should check amBlacklist- Returns:
- true if its blacklisted
-
allocate
public ContainerRequest allocate(NodeType type, SchedulerNode node, org.apache.hadoop.yarn.server.scheduler.SchedulerRequestKey schedulerKey, RMContainer containerAllocated) -
checkForDeactivation
public void checkForDeactivation() -
move
-
stop
public void stop() -
setQueue
-
getBlackListCopy
-
transferStateFromPreviousAppSchedulingInfo
-
recoverContainer
-
checkAllocation
public boolean checkAllocation(NodeType type, SchedulerNode node, org.apache.hadoop.yarn.server.scheduler.SchedulerRequestKey schedulerKey) -
updateMetrics
public static void updateMetrics(org.apache.hadoop.yarn.api.records.ApplicationId applicationId, NodeType type, SchedulerNode node, RMContainer containerAllocated, String user, Queue queue) -
getAppPlacementAllocator
public <N extends SchedulerNode> AppPlacementAllocator<N> getAppPlacementAllocator(org.apache.hadoop.yarn.server.scheduler.SchedulerRequestKey schedulerkey) -
canDelayTo
public boolean canDelayTo(org.apache.hadoop.yarn.server.scheduler.SchedulerRequestKey schedulerKey, String resourceName) Can delay to next?.- Parameters:
schedulerKey- schedulerKeyresourceName- resourceName- Returns:
- If request exists, return {relaxLocality} Otherwise, return true.
-
precheckNode
public boolean precheckNode(org.apache.hadoop.yarn.server.scheduler.SchedulerRequestKey schedulerKey, SchedulerNode schedulerNode, SchedulingMode schedulingMode, Optional<DiagnosticsCollector> dcOpt) Pre-check node to see if it satisfy the given schedulerKey and scheduler mode.- Parameters:
schedulerKey- schedulerKeyschedulerNode- schedulerNodeschedulingMode- schedulingModedcOpt- optional diagnostics collector- Returns:
- can use the node or not.
-
getApplicationSchedulingEnvs
Get scheduling envs configured for this application.- Returns:
- a map of applicationSchedulingEnvs
-
getDefaultNodeLabelExpression
Get the defaultNodeLabelExpression for the application's current queue.- Returns:
- defaultNodeLabelExpression
-
getRMContext
-