public class PreemptableResourceCalculator extends AbstractPreemptableResourceCalculator
PreemptionCandidatesSelector
context, isReservedPreemptionCandidatesSelector, rc
Constructor and Description |
---|
PreemptableResourceCalculator(CapacitySchedulerPreemptionContext preemptionContext,
boolean isReservedPreemptionCandidatesSelector,
boolean allowQueuesBalanceAfterAllQueuesSatisfied)
PreemptableResourceCalculator constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
computeIdealAllocation(org.apache.hadoop.yarn.api.records.Resource clusterResource,
org.apache.hadoop.yarn.api.records.Resource totalPreemptionAllowed) |
protected void |
computeIdealResourceDistribution(org.apache.hadoop.yarn.util.resource.ResourceCalculator rc,
List<TempQueuePerPartition> queues,
org.apache.hadoop.yarn.api.records.Resource totalPreemptionAllowed,
org.apache.hadoop.yarn.api.records.Resource tot_guarant)
This method computes (for a single level in the tree, passed as a
List<TempQueue> ) the ideal assignment of resources. |
protected void |
recursivelyComputeIdealAssignment(TempQueuePerPartition root,
org.apache.hadoop.yarn.api.records.Resource totalPreemptionAllowed)
This method recursively computes the ideal assignment of resources to each
level of the hierarchy.
|
computeFixpointAllocation, initIdealAssignment
public PreemptableResourceCalculator(CapacitySchedulerPreemptionContext preemptionContext, boolean isReservedPreemptionCandidatesSelector, boolean allowQueuesBalanceAfterAllQueuesSatisfied)
preemptionContext
- context.isReservedPreemptionCandidatesSelector
- this will be set by
different implementation of candidate selectors, please refer to
TempQueuePerPartition#offer for details.allowQueuesBalanceAfterAllQueuesSatisfied
- Should resources be preempted from an over-served queue when the
requesting queues are all at or over their guarantees?
An example is, there're 10 queues under root, guaranteed resource
of them are all 10%.
Assume there're two queues are using resources, queueA uses 10%
queueB uses 90%. For all queues are guaranteed, but it's not fair
for queueA.
We wanna make this behavior can be configured. By default it is
not allowed.protected void computeIdealResourceDistribution(org.apache.hadoop.yarn.util.resource.ResourceCalculator rc, List<TempQueuePerPartition> queues, org.apache.hadoop.yarn.api.records.Resource totalPreemptionAllowed, org.apache.hadoop.yarn.api.records.Resource tot_guarant)
List<TempQueue>
) the ideal assignment of resources. This is done
recursively to allocate capacity fairly across all queues with pending
demands. It terminates when no resources are left to assign, or when all
demand is satisfied.rc
- resource calculatorqueues
- a list of cloned queues to be assigned capacity to (this is
an out param)totalPreemptionAllowed
- total amount of preemption we allowtot_guarant
- the amount of capacity assigned to this pool of queuesprotected void recursivelyComputeIdealAssignment(TempQueuePerPartition root, org.apache.hadoop.yarn.api.records.Resource totalPreemptionAllowed)
root
- the root of the cloned queue hierachytotalPreemptionAllowed
- maximum amount of preemption allowedpublic void computeIdealAllocation(org.apache.hadoop.yarn.api.records.Resource clusterResource, org.apache.hadoop.yarn.api.records.Resource totalPreemptionAllowed)
Copyright © 2008–2023 Apache Software Foundation. All rights reserved.