Class FairOrderingPolicy<S extends SchedulableEntity>
java.lang.Object
org.apache.hadoop.yarn.server.resourcemanager.scheduler.policy.AbstractComparatorOrderingPolicy<S>
org.apache.hadoop.yarn.server.resourcemanager.scheduler.policy.FairOrderingPolicy<S>
- All Implemented Interfaces:
OrderingPolicy<S>
public class FairOrderingPolicy<S extends SchedulableEntity>
extends AbstractComparatorOrderingPolicy<S>
FairOrderingPolicy comparison goes through following steps.
1.Fairness based comparison. SchedulableEntities with lesser usage would be
preferred when compared to another. If sizedBasedWeight is set to true then
an application with high demand may be prioritized ahead of an application
with less usage. This is to offset the tendency to favor small apps, which
could result in starvation for large apps if many small ones enter and leave
the queue continuously (optional, default false)
2. Compare using job submit time. SchedulableEntities submitted earlier would
be preferred than later.
3. Compare demands. SchedulableEntities without resource demand get lower
priority than ones which have demands.
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsFields inherited from class org.apache.hadoop.yarn.server.resourcemanager.scheduler.policy.AbstractComparatorOrderingPolicy
comparator, entitiesToReorder, schedulableEntities -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidProvides configuration information for the policy from the scheduler configuration.voidcontainerAllocated(S schedulableEntity, RMContainer r) Notify theOrderingPolicythat theSchedulableEntityhas been allocated the givenRMContainer, enabling theOrderingPolicyto take appropriate action.voidcontainerReleased(S schedulableEntity, RMContainer r) Notify theOrderingPolicythat theSchedulableEntityhas released the givenRMContainer, enabling theOrderingPolicyto take appropriate action.voiddemandUpdated(S schedulableEntity) Notify theOrderingPolicythat the demand for theSchedulableEntityhas been updated, enabling theOrderingPolicyto reorder theSchedulableEntityif needed.Return configuration name (which will be used to set ordering policy).getInfo()Return information regarding configuration and status.booleanvoidsetSizeBasedWeight(boolean sizeBasedWeight) Methods inherited from class org.apache.hadoop.yarn.server.resourcemanager.scheduler.policy.AbstractComparatorOrderingPolicy
addAllSchedulableEntities, addSchedulableEntity, entityRequiresReordering, getAssignmentIterator, getComparator, getNumSchedulableEntities, getPreemptionIterator, getSchedulableEntities, removeSchedulableEntity, reorderSchedulableEntity, reorderScheduleEntities, updateSchedulingResourceUsage
-
Field Details
-
ENABLE_SIZE_BASED_WEIGHT
- See Also:
-
-
Constructor Details
-
FairOrderingPolicy
public FairOrderingPolicy()
-
-
Method Details
-
getSizeBasedWeight
@VisibleForTesting public boolean getSizeBasedWeight() -
setSizeBasedWeight
@VisibleForTesting public void setSizeBasedWeight(boolean sizeBasedWeight) -
configure
Description copied from interface:OrderingPolicyProvides configuration information for the policy from the scheduler configuration.- Specified by:
configurein interfaceOrderingPolicy<S extends SchedulableEntity>- Specified by:
configurein classAbstractComparatorOrderingPolicy<S extends SchedulableEntity>- Parameters:
conf- a map of scheduler configuration properties and values
-
containerAllocated
Description copied from interface:OrderingPolicyNotify theOrderingPolicythat theSchedulableEntityhas been allocated the givenRMContainer, enabling theOrderingPolicyto take appropriate action. Depending on the comparator, a reordering of theSchedulableEntitymay be required.- Specified by:
containerAllocatedin interfaceOrderingPolicy<S extends SchedulableEntity>- Specified by:
containerAllocatedin classAbstractComparatorOrderingPolicy<S extends SchedulableEntity>- Parameters:
schedulableEntity- theSchedulableEntityr- the allocatedRMContainer
-
containerReleased
Description copied from interface:OrderingPolicyNotify theOrderingPolicythat theSchedulableEntityhas released the givenRMContainer, enabling theOrderingPolicyto take appropriate action. Depending on the comparator, a reordering of theSchedulableEntitymay be required.- Specified by:
containerReleasedin interfaceOrderingPolicy<S extends SchedulableEntity>- Specified by:
containerReleasedin classAbstractComparatorOrderingPolicy<S extends SchedulableEntity>- Parameters:
schedulableEntity- theSchedulableEntityr- the releasedRMContainer
-
demandUpdated
Description copied from interface:OrderingPolicyNotify theOrderingPolicythat the demand for theSchedulableEntityhas been updated, enabling theOrderingPolicyto reorder theSchedulableEntityif needed.- Specified by:
demandUpdatedin interfaceOrderingPolicy<S extends SchedulableEntity>- Specified by:
demandUpdatedin classAbstractComparatorOrderingPolicy<S extends SchedulableEntity>- Parameters:
schedulableEntity- the updatedSchedulableEntity
-
getInfo
Description copied from interface:OrderingPolicyReturn information regarding configuration and status.- Specified by:
getInfoin interfaceOrderingPolicy<S extends SchedulableEntity>- Specified by:
getInfoin classAbstractComparatorOrderingPolicy<S extends SchedulableEntity>- Returns:
- configuration and status information
-
getConfigName
Description copied from interface:OrderingPolicyReturn configuration name (which will be used to set ordering policy).- Specified by:
getConfigNamein interfaceOrderingPolicy<S extends SchedulableEntity>- Specified by:
getConfigNamein classAbstractComparatorOrderingPolicy<S extends SchedulableEntity>- Returns:
- configuration name
-