Class DominantResourceFairnessPolicy
java.lang.Object
org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.SchedulingPolicy
org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.policies.DominantResourceFairnessPolicy
Makes scheduling decisions by trying to equalize dominant resource usage.
A schedulable's dominant resource usage is the largest ratio of resource
usage to capacity among the resource types it is using.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classThis class compares twoSchedulableinstances according to the DRF policy. -
Field Summary
FieldsFields inherited from class org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.SchedulingPolicy
DEFAULT_POLICY -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleancheckIfUsageOverFairShare(org.apache.hadoop.yarn.api.records.Resource usage, org.apache.hadoop.yarn.api.records.Resource fairShare) Check if the resource usage is over the fair share under this policy.voidcomputeShares(Collection<? extends Schedulable> schedulables, org.apache.hadoop.yarn.api.records.Resource totalResources) Computes and updates the shares ofSchedulables as per theSchedulingPolicy, to be used later for scheduling decisions.voidcomputeSteadyShares(Collection<? extends FSQueue> queues, org.apache.hadoop.yarn.api.records.Resource totalResources) Computes and updates the steady shares ofFSQueues as per theSchedulingPolicy.The comparator returned by this method is to be used for sorting theSchedulables in that queue.org.apache.hadoop.yarn.api.records.ResourcegetHeadroom(org.apache.hadoop.yarn.api.records.Resource queueFairShare, org.apache.hadoop.yarn.api.records.Resource queueUsage, org.apache.hadoop.yarn.api.records.Resource maxAvailable) Get headroom by calculating the min ofclusterAvailableand (queueFairShare-queueUsage) resources that are applicable to this policy.getName()org.apache.hadoop.yarn.util.resource.ResourceCalculatorTheResourceCalculatorreturned by this method should be used for any calculations involving resources.voidinitialize(FSContext fsContext) Initialize the scheduling policy with aFSContextobject, which has a pointer to the cluster resources among other information.Methods inherited from class org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.SchedulingPolicy
getInstance, initialize, isChildPolicyAllowed, parse
-
Field Details
-
NAME
- See Also:
-
-
Constructor Details
-
DominantResourceFairnessPolicy
public DominantResourceFairnessPolicy()
-
-
Method Details
-
getName
- Specified by:
getNamein classSchedulingPolicy- Returns:
- returns the name of
SchedulingPolicy
-
getComparator
Description copied from class:SchedulingPolicyThe comparator returned by this method is to be used for sorting theSchedulables in that queue.- Specified by:
getComparatorin classSchedulingPolicy- Returns:
- the comparator to sort by
-
getResourceCalculator
public org.apache.hadoop.yarn.util.resource.ResourceCalculator getResourceCalculator()Description copied from class:SchedulingPolicyTheResourceCalculatorreturned by this method should be used for any calculations involving resources.- Specified by:
getResourceCalculatorin classSchedulingPolicy- Returns:
- ResourceCalculator instance to use
-
getHeadroom
public org.apache.hadoop.yarn.api.records.Resource getHeadroom(org.apache.hadoop.yarn.api.records.Resource queueFairShare, org.apache.hadoop.yarn.api.records.Resource queueUsage, org.apache.hadoop.yarn.api.records.Resource maxAvailable) Description copied from class:SchedulingPolicyGet headroom by calculating the min ofclusterAvailableand (queueFairShare-queueUsage) resources that are applicable to this policy. For eg if only memory then leave other resources such as CPU to same asclusterAvailable.- Specified by:
getHeadroomin classSchedulingPolicy- Parameters:
queueFairShare- fairshare in the queuequeueUsage- resources used in the queuemaxAvailable- available resource in cluster for this queue- Returns:
- calculated headroom
-
initialize
Description copied from class:SchedulingPolicyInitialize the scheduling policy with aFSContextobject, which has a pointer to the cluster resources among other information.- Overrides:
initializein classSchedulingPolicy- Parameters:
fsContext- aFSContextobject which has a pointer to the cluster resources
-