Class FSQueue
java.lang.Object
org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.FSQueue
- All Implemented Interfaces:
Schedulable,Queue
- Direct Known Subclasses:
FSLeafQueue,FSParentQueue
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected floatprotected org.apache.hadoop.yarn.api.records.Resourceprotected intprotected org.apache.hadoop.yarn.api.records.Resourceprotected final FSParentQueueprotected SchedulingPolicyprotected final org.apache.hadoop.yarn.factories.RecordFactoryprotected final FairSchedulerprotected float -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract voidcollectSchedulerApplications(Collection<org.apache.hadoop.yarn.api.records.ApplicationAttemptId> apps) Adds all applications in the queue and its subqueues to the given collection.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.voiddecReservedResource(String nodeLabel, org.apache.hadoop.yarn.api.records.Resource resourceToDec) Decrement Reserved Capacityprotected voiddecUsedResource(org.apache.hadoop.yarn.api.records.Resource res) Decrease resource usage for this queue and all parent queues.Recursively dump states of all queues.protected abstract voidRecursively dump states of all queues.Get labels can be accessed of this queue labels={*}, means this queue can access any label labels={ }, means this queue cannot access any label except node without label labels={a, b, c} means this queue can access a or b or cGets the children of this queue, if any.org.apache.hadoop.yarn.api.records.PriorityGet the Default Application Priority for this queueGet default label expression of this queue.org.apache.hadoop.yarn.api.records.ResourceGet the fair share assigned to this Schedulable.floatabstract org.apache.hadoop.yarn.api.records.Resourceintorg.apache.hadoop.yarn.api.records.ResourceMaximum Resource share assigned to the schedulable.Get the queue metricsorg.apache.hadoop.yarn.api.records.ResourceMinimum Resource share assigned to the schedulable.getName()Name of job/queue, used for debugging as well as for breaking ties in scheduling order deterministically.abstract intReturn the number of apps for which containers can be allocated.org.apache.hadoop.yarn.api.records.PriorityJob priority for jobs in FIFO queues; meaningless for QueueSchedulables.org.apache.hadoop.yarn.api.records.QueueInfogetQueueInfo(boolean includeChildQueues, boolean recursive) Get queue informationGet the queue nameorg.apache.hadoop.yarn.api.records.QueueStatisticsorg.apache.hadoop.yarn.api.records.Resourceorg.apache.hadoop.yarn.api.records.ResourceGet the aggregate amount of resources consumed by the schedulable.longStart time for jobs in FIFO queues; meaningless for QueueSchedulables.org.apache.hadoop.yarn.api.records.ResourceGet the steady fair share assigned to this Schedulable.floatJob/queue weight in fair sharing.booleanhasAccess(org.apache.hadoop.yarn.api.records.QueueACL acl, org.apache.hadoop.security.UserGroupInformation user) voidincPendingResource(String nodeLabel, org.apache.hadoop.yarn.api.records.Resource resourceToInc) When new outstanding resource is asked, calling this will increase pending resource in a queue.voidincReservedResource(String nodeLabel, org.apache.hadoop.yarn.api.records.Resource resourceToInc) Increment Reserved CapacityvoidincUsedResource(org.apache.hadoop.yarn.api.records.Resource res) Increase resource usage for this queue and all parent queues.booleanisActive()Returns true if queue has at least one app running.booleanabstract booleanisEmpty()booleanCheck whether the schedulable is preemptable.final voidreinit(boolean recursive) Initialize a queue by setting its queue-specific properties and its metrics.voidsetDynamic(boolean dynamic) voidsetFairShare(org.apache.hadoop.yarn.api.records.Resource fairShare) Assign a fair share to this Schedulable.voidsetMaxAMShare(float maxAMShare) voidsetMaxChildQueueResource(ConfigurableResource maxChildShare) voidsetMaxContainerAllocation(org.apache.hadoop.yarn.api.records.Resource maxContainerAllocation) voidsetMaxRunningApps(int maxRunningApps) voidsetMaxShare(ConfigurableResource maxShare) voidsetMinShare(org.apache.hadoop.yarn.api.records.Resource minShare) voidsetPolicy(SchedulingPolicy policy) voidsetWeights(float weights) toString()Convenient toString implementation for debugging.voidupdate(org.apache.hadoop.yarn.api.records.Resource fairShare) Set the queue's fairshare and update the demand/fairshare of child queues/applications.booleanRecursively check policies for queues in pre-order.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.apache.hadoop.yarn.server.resourcemanager.scheduler.Queue
getAbstractUsersManager, getQueueUserAclInfo, recoverContainerMethods inherited from interface org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.Schedulable
assignContainer, getDemand, updateDemand
-
Field Details
-
scheduler
-
parent
-
recordFactory
protected final org.apache.hadoop.yarn.factories.RecordFactory recordFactory -
policy
-
weights
protected float weights -
maxRunningApps
protected int maxRunningApps -
maxContainerAllocation
protected org.apache.hadoop.yarn.api.records.Resource maxContainerAllocation
-
-
Constructor Details
-
FSQueue
-
-
Method Details
-
reinit
public final void reinit(boolean recursive) Initialize a queue by setting its queue-specific properties and its metrics. This method is invoked when creating a new queue or reloading the allocation file. This method does not set policies for queues when reloading the allocation file since we need to either set all new policies or nothing, which is handled by methodverifyAndSetPolicyFromConf(org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.AllocationConfiguration).- Parameters:
recursive- whether child queues should be reinitialized recursively
-
getName
Description copied from interface:SchedulableName of job/queue, used for debugging as well as for breaking ties in scheduling order deterministically.- Specified by:
getNamein interfaceSchedulable- Returns:
- Name of job/queue.
-
getQueueName
Description copied from interface:QueueGet the queue name- Specified by:
getQueueNamein interfaceQueue- Returns:
- queue name
-
getPolicy
-
getParent
-
setPolicy
-
setWeights
public void setWeights(float weights) -
getWeight
public float getWeight()Description copied from interface:SchedulableJob/queue weight in fair sharing. Weights are only meaningful when compared. A weight of 2.0f has twice the weight of a weight of 1.0f, which has twice the weight of a weight of 0.5f. A weight of 1.0f is considered unweighted or a neutral weight. A weight of 0 is no weight.- Specified by:
getWeightin interfaceSchedulable- Returns:
- the weight
-
setMaxContainerAllocation
public void setMaxContainerAllocation(org.apache.hadoop.yarn.api.records.Resource maxContainerAllocation) -
getMaximumContainerAllocation
public abstract org.apache.hadoop.yarn.api.records.Resource getMaximumContainerAllocation() -
getReservedResource
public org.apache.hadoop.yarn.api.records.Resource getReservedResource() -
setMaxChildQueueResource
-
getMaxChildQueueResource
-
setMaxRunningApps
public void setMaxRunningApps(int maxRunningApps) -
getMaxRunningApps
public int getMaxRunningApps() -
getStartTime
public long getStartTime()Description copied from interface:SchedulableStart time for jobs in FIFO queues; meaningless for QueueSchedulables.- Specified by:
getStartTimein interfaceSchedulable- Returns:
- Start time for jobs.
-
getPriority
public org.apache.hadoop.yarn.api.records.Priority getPriority()Description copied from interface:SchedulableJob priority for jobs in FIFO queues; meaningless for QueueSchedulables.- Specified by:
getPriorityin interfaceSchedulable- Returns:
- Job priority.
-
getQueueInfo
public org.apache.hadoop.yarn.api.records.QueueInfo getQueueInfo(boolean includeChildQueues, boolean recursive) Description copied from interface:QueueGet queue information- Specified by:
getQueueInfoin interfaceQueue- Parameters:
includeChildQueues- include child queues?recursive- recursively get child queue information?- Returns:
- queue information
-
getQueueStatistics
public org.apache.hadoop.yarn.api.records.QueueStatistics getQueueStatistics() -
getMetrics
Description copied from interface:QueueGet the queue metrics- Specified by:
getMetricsin interfaceQueue- Returns:
- the queue metrics
-
hasAccess
public boolean hasAccess(org.apache.hadoop.yarn.api.records.QueueACL acl, org.apache.hadoop.security.UserGroupInformation user) -
isPreemptable
public boolean isPreemptable()Description copied from interface:SchedulableCheck whether the schedulable is preemptable.- Specified by:
isPreemptablein interfaceSchedulable- Returns:
trueif the schedulable is preemptable;falseotherwise
-
update
public void update(org.apache.hadoop.yarn.api.records.Resource fairShare) Set the queue's fairshare and update the demand/fairshare of child queues/applications. To be called holding the scheduler writelock.- Parameters:
fairShare- queue's fairshare.
-
getChildQueues
Gets the children of this queue, if any.- Returns:
- the children of this queue.
-
collectSchedulerApplications
public abstract 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
-
getNumRunnableApps
public abstract int getNumRunnableApps()Return the number of apps for which containers can be allocated. Includes apps in subqueues.- Returns:
- the number of apps.
-
isActive
public boolean isActive()Returns true if queue has at least one app running.- Returns:
- true, if queue has at least one app running; otherwise, false;
-
toString
Convenient toString implementation for debugging. -
getAccessibleNodeLabels
Description copied from interface:QueueGet labels can be accessed of this queue labels={*}, means this queue can access any label labels={ }, means this queue cannot access any label except node without label labels={a, b, c} means this queue can access a or b or c- Specified by:
getAccessibleNodeLabelsin interfaceQueue- Returns:
- labels
-
getDefaultNodeLabelExpression
Description copied from interface:QueueGet default label expression of this queue. If label expression of ApplicationSubmissionContext and label expression of Resource Request not set, this will be used.- Specified by:
getDefaultNodeLabelExpressionin interfaceQueue- Returns:
- default label expression
-
incPendingResource
public void incPendingResource(String nodeLabel, org.apache.hadoop.yarn.api.records.Resource resourceToInc) Description copied from interface:QueueWhen new outstanding resource is asked, calling this will increase pending resource in a queue.- Specified by:
incPendingResourcein interfaceQueue- Parameters:
nodeLabel- asked by applicationresourceToInc- new resource asked
-
decPendingResource
public void decPendingResource(String nodeLabel, org.apache.hadoop.yarn.api.records.Resource resourceToDec) Description copied from interface:QueueWhen 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
-
incReservedResource
public void incReservedResource(String nodeLabel, org.apache.hadoop.yarn.api.records.Resource resourceToInc) Description copied from interface:QueueIncrement Reserved Capacity- Specified by:
incReservedResourcein interfaceQueue- Parameters:
nodeLabel- asked by applicationresourceToInc- reserved resource asked
-
decReservedResource
public void decReservedResource(String nodeLabel, org.apache.hadoop.yarn.api.records.Resource resourceToDec) Description copied from interface:QueueDecrement Reserved Capacity- Specified by:
decReservedResourcein interfaceQueue- Parameters:
nodeLabel- asked by applicationresourceToDec- reserved resource asked
-
getResourceUsage
public org.apache.hadoop.yarn.api.records.Resource getResourceUsage()Description copied from interface:SchedulableGet the aggregate amount of resources consumed by the schedulable.- Specified by:
getResourceUsagein interfaceSchedulable- Returns:
- aggregate amount of resources.
-
incUsedResource
public void incUsedResource(org.apache.hadoop.yarn.api.records.Resource res) Increase resource usage for this queue and all parent queues.- Parameters:
res- the resource to increase
-
decUsedResource
protected void decUsedResource(org.apache.hadoop.yarn.api.records.Resource res) Decrease resource usage for this queue and all parent queues.- Parameters:
res- the resource to decrease
-
getDefaultApplicationPriority
public org.apache.hadoop.yarn.api.records.Priority getDefaultApplicationPriority()Description copied from interface:QueueGet the Default Application Priority for this queue- Specified by:
getDefaultApplicationPriorityin interfaceQueue- Returns:
- default application priority
-
verifyAndSetPolicyFromConf
Recursively check policies for queues in pre-order. Get queue policies from the allocation file instead of properties ofFSQueueobjects. Set the policy for current queue if there is no policy violation for its children. This method is invoked while reloading the allocation file.- Parameters:
queueConf- allocation configuration- Returns:
- true if no policy violation and successfully set polices for queues; false otherwise
-
dumpState
Recursively dump states of all queues.- Returns:
- a string which holds all queue states
-
dumpStateInternal
Recursively dump states of all queues.- Parameters:
sb- the {code StringBuilder} which holds queue states
-
isDynamic
public boolean isDynamic() -
setDynamic
public void setDynamic(boolean dynamic) -
isEmpty
public abstract boolean isEmpty()
-