Interface CSQueue
- All Superinterfaces:
Queue,SchedulerQueue<CSQueue>
- All Known Implementing Classes:
AbstractAutoCreatedLeafQueue,AbstractCSQueue,AbstractLeafQueue,AbstractManagedParentQueue,AbstractParentQueue,AutoCreatedLeafQueue,LeafQueue,ManagedParentQueue,ParentQueue,PlanQueue,ReservationQueue
CSQueue represents a node in the tree of
hierarchical queues in the CapacityScheduler.-
Method Summary
Modifier and TypeMethodDescriptionbooleanaccept(org.apache.hadoop.yarn.api.records.Resource cluster, ResourceCommitRequest<FiCaSchedulerApp, FiCaSchedulerNode> request) voidapply(org.apache.hadoop.yarn.api.records.Resource cluster, ResourceCommitRequest<FiCaSchedulerApp, FiCaSchedulerNode> request) assignContainers(org.apache.hadoop.yarn.api.records.Resource clusterResource, FiCaSchedulerNode node, ResourceLimits resourceLimits, SchedulingMode schedulingMode) assignContainers(org.apache.hadoop.yarn.api.records.Resource clusterResource, CandidateNodeSet<FiCaSchedulerNode> candidates, ResourceLimits resourceLimits, SchedulingMode schedulingMode) Assign containers to applications in the queue or it's children (if any).voidattachContainer(org.apache.hadoop.yarn.api.records.Resource clusterResource, FiCaSchedulerApp application, RMContainer container) Attach a container to this queuevoidcollectSchedulerApplications(Collection<org.apache.hadoop.yarn.api.records.ApplicationAttemptId> apps) Adds all applications in the queue and its subqueues to the given collection.voidcompletedContainer(org.apache.hadoop.yarn.api.records.Resource clusterResource, FiCaSchedulerApp application, FiCaSchedulerNode node, RMContainer container, org.apache.hadoop.yarn.api.records.ContainerStatus containerStatus, RMContainerEventType event, CSQueue childQueue, boolean sortQueues) A container assigned to the queue has completed.voiddecPendingResource(String nodeLabel, org.apache.hadoop.yarn.api.records.Resource resourceToDec) When an outstanding resource is fulfilled or canceled, calling this will decrease pending resource in a queue.voiddecUsedResource(String nodePartition, org.apache.hadoop.yarn.api.records.Resource resourceToDec, SchedulerApplicationAttempt application) When partition of node updated, we will update queue's resource usage if it has container(s) running on that.voiddetachContainer(org.apache.hadoop.yarn.api.records.Resource clusterResource, FiCaSchedulerApp application, RMContainer container) Detach a container from this queuevoidfinishApplication(org.apache.hadoop.yarn.api.records.ApplicationId applicationId, String user) An application submitted to this queue has finished.voidfinishApplicationAttempt(FiCaSchedulerApp application, String queue) An application attempt submitted to this queue has finished.floatGet capacity of the parent of the queue as a function of the cumulative capacity in the cluster.floatGet maximum-capacity of the queue as a funciton of the cumulative capacity of the cluster.floatGet the current absolute used capacity of the queue relative to the entire cluster.Get theAbstractUsersManagerfor the queue.floatGet the configured capacity of the queue.Get CapacityConfigType as PERCENTAGE or ABSOLUTE_RESOURCE.Get child queuesGet child queues By tryLock.Get configured capacity vector parsed from the capacity config of the queue.Get configured maximum capacity vector parsed from the capacity config of the queue.longGet the default lifetime in seconds of an application which is submitted to this queue.booleanGet the indicator of whether or not the default application lifetime was set by a config property or was calculated by the capacity scheduler.org.apache.hadoop.yarn.api.records.ResourcegetEffectiveCapacity(String label) Get effective capacity of queue.org.apache.hadoop.yarn.api.records.ResourcegetEffectiveCapacityDown(String label, org.apache.hadoop.yarn.api.records.Resource factor) Get effective capacity of queue.org.apache.hadoop.yarn.api.records.ResourcegetEffectiveMaxCapacity(String label) Get effective max capacity of queue.org.apache.hadoop.yarn.api.records.ResourcegetEffectiveMaxCapacityDown(String label, org.apache.hadoop.yarn.api.records.Resource factor) Get effective max capacity of queue.booleanCheck whether intra-queue preemption is disabled for this queuebooleanDetermines whether or not the intra-queue preemption disabled switch is set at any level in this queue's hierarchy.org.apache.hadoop.yarn.api.records.ResourcelongGet the maximum lifetime in seconds of an application which is submitted to this queue.floatGet the configured maximum-capacity of the queue.intGet the max-parallel-applications property of the queueorg.apache.hadoop.yarn.api.records.ResourceGet Multi Node scheduling policy name.Get valid Node Labels for this queueintGet the number of applications in the queue.Get the parentQueue.booleanCheck whether disable_preemption property is set for this queueorg.apache.hadoop.yarn.api.records.PriorityGet priority of queueorg.apache.hadoop.yarn.security.PrivilegedEntityGet QueueCapacities of this queueGet the queue's internal reference name.Get the full name of the queue, including the heirarchy.Gets the queue path object.Get QueueResourceQuotas associated with each queue.Get ResourceUsage of this queueGet the queue's legacy name.Get readLock associated with the Queue.org.apache.hadoop.yarn.api.records.QueueStategetState()Get the current run-state of the queuefloatGet the current used capacity of nodes without label(s) of the queue and it's children (if any).org.apache.hadoop.yarn.api.records.ResourceGet the currently utilized resources which allocated at nodes without any labels in the cluster by the queue and children (if any).Get the UserWeights object that wraps a map of usernames and weightsGet writeLock associated with the Queue.booleanhasAccess(org.apache.hadoop.yarn.api.records.QueueACL acl, org.apache.hadoop.security.UserGroupInformation user) Check if theuserhas permission to perform the operationvoidincUsedResource(String nodePartition, org.apache.hadoop.yarn.api.records.Resource resourceToInc, SchedulerApplicationAttempt application) When partition of node updated, we will update queue's resource usage if it has container(s) running on that.booleanChecks whether the queue is a dynamic queue (created dynamically in the fashion of auto queue creation v2).voidrefreshAfterResourceCalculation(org.apache.hadoop.yarn.api.records.Resource clusterResource, ResourceLimits resourceLimits) voidreinitialize(CSQueue newlyParsedQueue, org.apache.hadoop.yarn.api.records.Resource clusterResource) Reinitialize the queue.voidsetConfiguredMaxCapacityVector(String label, QueueCapacityVector maxCapacityVector) Sets the configured maximum capacity vector to a specific value.voidsetConfiguredMinCapacityVector(String label, QueueCapacityVector minCapacityVector) Sets the configured minimum capacity vector to a specific value.voidSet the parentQueue.voidsubmitApplication(org.apache.hadoop.yarn.api.records.ApplicationId applicationId, String user, String queue) Submit a new application to the queue.voidsubmitApplicationAttempt(FiCaSchedulerApp application, String userName) Submit an application attempt to the queue.voidsubmitApplicationAttempt(FiCaSchedulerApp application, String userName, boolean isMoveApp) Submit an application attempt to the queue.voidupdateClusterResource(org.apache.hadoop.yarn.api.records.Resource clusterResource, ResourceLimits resourceLimits) Update the cluster resource for queues as we add/remove nodesvoidvalidateSubmitApplication(org.apache.hadoop.yarn.api.records.ApplicationId applicationId, String userName, String queue) Validate submitApplication api so that moveApplication do a pre-check.Methods inherited from interface org.apache.hadoop.yarn.server.resourcemanager.scheduler.Queue
decReservedResource, getAccessibleNodeLabels, getDefaultApplicationPriority, getDefaultNodeLabelExpression, getMetrics, getQueueInfo, getQueueUserAclInfo, incPendingResource, incReservedResource, recoverContainerMethods inherited from interface org.apache.hadoop.yarn.server.resourcemanager.scheduler.SchedulerQueue
activateQueue, stopQueue, updateQueueState
-
Method Details
-
getParent
CSQueue getParent()Get the parentQueue.- Specified by:
getParentin interfaceSchedulerQueue<CSQueue>- Returns:
- the parent queue
-
setParent
Set the parentQueue.- Parameters:
newParentQueue- new parent queue
-
getQueueName
String getQueueName()Get the queue's internal reference name.- Specified by:
getQueueNamein interfaceQueue- Returns:
- the queue name
-
getQueueShortName
String getQueueShortName()Get the queue's legacy name.- Returns:
- the queue name
-
getQueuePath
String getQueuePath()Get the full name of the queue, including the heirarchy.- Returns:
- the full name of the queue
-
getQueuePathObject
QueuePath getQueuePathObject()Gets the queue path object.- Returns:
- the object of the queue
-
isDynamicQueue
boolean isDynamicQueue()Checks whether the queue is a dynamic queue (created dynamically in the fashion of auto queue creation v2).- Returns:
- true, if it is a dynamic queue, false otherwise
-
getPrivilegedEntity
org.apache.hadoop.yarn.security.PrivilegedEntity getPrivilegedEntity() -
getMaximumAllocation
org.apache.hadoop.yarn.api.records.Resource getMaximumAllocation() -
getMinimumAllocation
org.apache.hadoop.yarn.api.records.Resource getMinimumAllocation() -
getCapacity
float getCapacity()Get the configured capacity of the queue.- Returns:
- configured queue capacity
-
getAbsoluteCapacity
float getAbsoluteCapacity()Get capacity of the parent of the queue as a function of the cumulative capacity in the cluster.- Returns:
- capacity of the parent of the queue as a function of the cumulative capacity in the cluster
-
getMaximumCapacity
float getMaximumCapacity()Get the configured maximum-capacity of the queue.- Returns:
- the configured maximum-capacity of the queue
-
getAbsoluteMaximumCapacity
float getAbsoluteMaximumCapacity()Get maximum-capacity of the queue as a funciton of the cumulative capacity of the cluster.- Returns:
- maximum-capacity of the queue as a funciton of the cumulative capacity of the cluster
-
getAbsoluteUsedCapacity
float getAbsoluteUsedCapacity()Get the current absolute used capacity of the queue relative to the entire cluster.- Returns:
- queue absolute used capacity
-
getUsedCapacity
float getUsedCapacity()Get the current used capacity of nodes without label(s) of the queue and it's children (if any).- Returns:
- queue used capacity
-
getUsedResources
org.apache.hadoop.yarn.api.records.Resource getUsedResources()Get the currently utilized resources which allocated at nodes without any labels in the cluster by the queue and children (if any).- Returns:
- used resources by the queue and it's children
-
getState
org.apache.hadoop.yarn.api.records.QueueState getState()Get the current run-state of the queue- Specified by:
getStatein interfaceSchedulerQueue<CSQueue>- Returns:
- current run-state
-
getMaxParallelApps
int getMaxParallelApps()Get the max-parallel-applications property of the queue- Returns:
- max-parallel-applications
-
getChildQueues
Get child queues- Specified by:
getChildQueuesin interfaceSchedulerQueue<CSQueue>- Returns:
- child queues
-
getChildQueuesByTryLock
Get child queues By tryLock.- Returns:
- child queues
-
hasAccess
boolean hasAccess(org.apache.hadoop.yarn.api.records.QueueACL acl, org.apache.hadoop.security.UserGroupInformation user) Check if theuserhas permission to perform the operation -
submitApplication
void submitApplication(org.apache.hadoop.yarn.api.records.ApplicationId applicationId, String user, String queue) throws org.apache.hadoop.security.AccessControlException Submit a new application to the queue.- Parameters:
applicationId- the applicationId of the application being submitteduser- user who submitted the applicationqueue- queue to which the application is submitted- Throws:
org.apache.hadoop.security.AccessControlException- if any acl violation is there.
-
submitApplicationAttempt
Submit an application attempt to the queue.- Parameters:
application- application whose attempt is being submitted.userName- userName who submitted the application.
-
submitApplicationAttempt
Submit an application attempt to the queue.- Parameters:
application- application whose attempt is being submitteduserName- user who submitted the application attemptisMoveApp- is application being moved across the queue
-
finishApplication
An application submitted to this queue has finished.- Parameters:
applicationId- applicationId.user- user who submitted the application
-
finishApplicationAttempt
An application attempt submitted to this queue has finished.- Parameters:
application- application attempt.queue- queue.
-
assignContainers
CSAssignment assignContainers(org.apache.hadoop.yarn.api.records.Resource clusterResource, CandidateNodeSet<FiCaSchedulerNode> candidates, ResourceLimits resourceLimits, SchedulingMode schedulingMode) Assign containers to applications in the queue or it's children (if any).- Parameters:
clusterResource- the resource of the cluster.candidates-CandidateNodeSetthe nodes that are considered for the current placement.resourceLimits- how much overall resource of this queue can use.schedulingMode- Type of exclusive check when assign container on a NodeManager, seeSchedulingMode.- Returns:
- the assignment
-
completedContainer
void completedContainer(org.apache.hadoop.yarn.api.records.Resource clusterResource, FiCaSchedulerApp application, FiCaSchedulerNode node, RMContainer container, org.apache.hadoop.yarn.api.records.ContainerStatus containerStatus, RMContainerEventType event, CSQueue childQueue, boolean sortQueues) A container assigned to the queue has completed.- Parameters:
clusterResource- the resource of the clusterapplication- application to which the container was assignednode- node on which the container completedcontainer- completed container,nullif it was just a reservationcontainerStatus-ContainerStatusfor the completed containerchildQueue-CSQueueto reinsert in childQueuesevent- event to be sent to the containersortQueues- indicates whether it should re-sort the queues
-
getNumApplications
int getNumApplications()Get the number of applications in the queue.- Returns:
- number of applications
-
reinitialize
void reinitialize(CSQueue newlyParsedQueue, org.apache.hadoop.yarn.api.records.Resource clusterResource) throws IOException Reinitialize the queue.- Parameters:
newlyParsedQueue- new queue to re-initalize fromclusterResource- resources in the cluster- Throws:
IOException- an I/O exception has occurred.
-
refreshAfterResourceCalculation
void refreshAfterResourceCalculation(org.apache.hadoop.yarn.api.records.Resource clusterResource, ResourceLimits resourceLimits) -
updateClusterResource
void updateClusterResource(org.apache.hadoop.yarn.api.records.Resource clusterResource, ResourceLimits resourceLimits) Update the cluster resource for queues as we add/remove nodes- Parameters:
clusterResource- the current cluster resourceresourceLimits- the current ResourceLimits
-
getAbstractUsersManager
AbstractUsersManager getAbstractUsersManager()Get theAbstractUsersManagerfor the queue.- Specified by:
getAbstractUsersManagerin interfaceQueue- Returns:
- the
AbstractUsersManagerfor the queue
-
collectSchedulerApplications
void collectSchedulerApplications(Collection<org.apache.hadoop.yarn.api.records.ApplicationAttemptId> apps) Adds all applications in the queue and its subqueues to the given collection.- Parameters:
apps- the collection to add the applications to
-
detachContainer
void detachContainer(org.apache.hadoop.yarn.api.records.Resource clusterResource, FiCaSchedulerApp application, RMContainer container) Detach a container from this queue- Parameters:
clusterResource- the current cluster resourceapplication- application to which the container was assignedcontainer- the container to detach
-
attachContainer
void attachContainer(org.apache.hadoop.yarn.api.records.Resource clusterResource, FiCaSchedulerApp application, RMContainer container) Attach a container to this queue- Parameters:
clusterResource- the current cluster resourceapplication- application to which the container was assignedcontainer- the container to attach
-
getPreemptionDisabled
boolean getPreemptionDisabled()Check whether disable_preemption property is set for this queue- Returns:
- true if disable_preemption is set, false if not
-
getIntraQueuePreemptionDisabled
boolean getIntraQueuePreemptionDisabled()Check whether intra-queue preemption is disabled for this queue- Returns:
- true if either intra-queue preemption or inter-queue preemption is disabled for this queue, false if neither is disabled.
-
getIntraQueuePreemptionDisabledInHierarchy
boolean getIntraQueuePreemptionDisabledInHierarchy()Determines whether or not the intra-queue preemption disabled switch is set at any level in this queue's hierarchy.- Returns:
- state of the intra-queue preemption switch at this queue level
-
getQueueCapacities
QueueCapacities getQueueCapacities()Get QueueCapacities of this queue- Returns:
- queueCapacities
-
getQueueResourceUsage
ResourceUsage getQueueResourceUsage()Get ResourceUsage of this queue- Returns:
- resourceUsage
-
incUsedResource
void incUsedResource(String nodePartition, org.apache.hadoop.yarn.api.records.Resource resourceToInc, SchedulerApplicationAttempt application) When partition of node updated, we will update queue's resource usage if it has container(s) running on that.- Parameters:
nodePartition- node label.resourceToInc- resource.application- application.
-
decUsedResource
void decUsedResource(String nodePartition, org.apache.hadoop.yarn.api.records.Resource resourceToDec, SchedulerApplicationAttempt application) When partition of node updated, we will update queue's resource usage if it has container(s) running on that.- Parameters:
nodePartition- node label.resourceToDec- resource.application- application.
-
decPendingResource
void decPendingResource(String nodeLabel, org.apache.hadoop.yarn.api.records.Resource resourceToDec) When an outstanding resource is fulfilled or canceled, calling this will decrease pending resource in a queue.- Specified by:
decPendingResourcein interfaceQueue- Parameters:
nodeLabel- asked by applicationresourceToDec- new resource asked
-
getNodeLabelsForQueue
Get valid Node Labels for this queue- Returns:
- valid node labels
-
assignContainers
@VisibleForTesting CSAssignment assignContainers(org.apache.hadoop.yarn.api.records.Resource clusterResource, FiCaSchedulerNode node, ResourceLimits resourceLimits, SchedulingMode schedulingMode) -
accept
boolean accept(org.apache.hadoop.yarn.api.records.Resource cluster, ResourceCommitRequest<FiCaSchedulerApp, FiCaSchedulerNode> request) -
apply
void apply(org.apache.hadoop.yarn.api.records.Resource cluster, ResourceCommitRequest<FiCaSchedulerApp, FiCaSchedulerNode> request) -
getReadLock
ReentrantReadWriteLock.ReadLock getReadLock()Get readLock associated with the Queue.- Returns:
- readLock of corresponding queue.
-
getWriteLock
ReentrantReadWriteLock.WriteLock getWriteLock()Get writeLock associated with the Queue.- Returns:
- writeLock of corresponding queue.
-
validateSubmitApplication
void validateSubmitApplication(org.apache.hadoop.yarn.api.records.ApplicationId applicationId, String userName, String queue) throws org.apache.hadoop.security.AccessControlException Validate submitApplication api so that moveApplication do a pre-check.- Parameters:
applicationId- Application IDuserName- User Namequeue- Queue Name- Throws:
org.apache.hadoop.security.AccessControlException- if any acl violation is there.
-
getPriority
org.apache.hadoop.yarn.api.records.Priority getPriority()Get priority of queue- Returns:
- queue priority
-
getUserWeights
UserWeights getUserWeights()Get the UserWeights object that wraps a map of usernames and weights- Returns:
- The UserWeights object.
-
getQueueResourceQuotas
QueueResourceQuotas getQueueResourceQuotas()Get QueueResourceQuotas associated with each queue.- Returns:
- QueueResourceQuotas
-
getCapacityConfigType
AbstractCSQueue.CapacityConfigType getCapacityConfigType()Get CapacityConfigType as PERCENTAGE or ABSOLUTE_RESOURCE.- Returns:
- CapacityConfigType
-
getEffectiveCapacity
Get effective capacity of queue. If min/max resource is configured, preference will be given to absolute configuration over normal capacity.- Parameters:
label- partition- Returns:
- effective queue capacity
-
getConfiguredCapacityVector
Get configured capacity vector parsed from the capacity config of the queue.- Parameters:
label- node label (partition)- Returns:
- capacity resource vector
-
getConfiguredMaxCapacityVector
Get configured maximum capacity vector parsed from the capacity config of the queue.- Parameters:
label- node label (partition)- Returns:
- capacity resource vector
-
setConfiguredMinCapacityVector
Sets the configured minimum capacity vector to a specific value.- Parameters:
label- node label (partition)minCapacityVector- capacity vector
-
setConfiguredMaxCapacityVector
Sets the configured maximum capacity vector to a specific value.- Parameters:
label- node label (partition)maxCapacityVector- capacity vector
-
getConfiguredNodeLabels
-
getEffectiveCapacityDown
org.apache.hadoop.yarn.api.records.Resource getEffectiveCapacityDown(String label, org.apache.hadoop.yarn.api.records.Resource factor) Get effective capacity of queue. If min/max resource is configured, preference will be given to absolute configuration over normal capacity. Also round down the result to normalizeDown.- Parameters:
label- partitionfactor- factor to normalize down- Returns:
- effective queue capacity
-
getEffectiveMaxCapacity
Get effective max capacity of queue. If min/max resource is configured, preference will be given to absolute configuration over normal capacity.- Parameters:
label- partition- Returns:
- effective max queue capacity
-
getEffectiveMaxCapacityDown
org.apache.hadoop.yarn.api.records.Resource getEffectiveMaxCapacityDown(String label, org.apache.hadoop.yarn.api.records.Resource factor) Get effective max capacity of queue. If min/max resource is configured, preference will be given to absolute configuration over normal capacity. Also round down the result to normalizeDown.- Parameters:
label- partitionfactor- factor to normalize down- Returns:
- effective max queue capacity
-
getMultiNodeSortingPolicyClassName
String getMultiNodeSortingPolicyClassName()Get Multi Node scheduling policy name.- Returns:
- policy name
-
getMaximumApplicationLifetime
long getMaximumApplicationLifetime()Get the maximum lifetime in seconds of an application which is submitted to this queue. Apps can set their own lifetime timeout up to this value.- Returns:
- max lifetime in seconds
-
getDefaultApplicationLifetime
long getDefaultApplicationLifetime()Get the default lifetime in seconds of an application which is submitted to this queue. If an app doesn't specify its own timeout when submitted, this value will be used.- Returns:
- default app lifetime
-
getDefaultAppLifetimeWasSpecifiedInConfig
boolean getDefaultAppLifetimeWasSpecifiedInConfig()Get the indicator of whether or not the default application lifetime was set by a config property or was calculated by the capacity scheduler.- Returns:
- indicator whether set or calculated
-