Class AbstractComparatorOrderingPolicy<S extends SchedulableEntity>
java.lang.Object
org.apache.hadoop.yarn.server.resourcemanager.scheduler.policy.AbstractComparatorOrderingPolicy<S>
- All Implemented Interfaces:
OrderingPolicy<S>
- Direct Known Subclasses:
FairOrderingPolicy,FifoOrderingPolicy,FifoOrderingPolicyForPendingApps
public abstract class AbstractComparatorOrderingPolicy<S extends SchedulableEntity>
extends Object
implements OrderingPolicy<S>
An OrderingPolicy which can serve as a baseclass for policies which can be
expressed in terms of comparators
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Comparator<SchedulableEntity>protected ConcurrentSkipListSet<S> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAdd a collection ofSchedulableEntityobjects to be managed for allocation and preemption ordering.voidAdd aSchedulableEntityto be managed for allocation and preemption ordering.abstract voidProvides configuration information for the policy from the scheduler configuration.abstract voidcontainerAllocated(S schedulableEntity, RMContainer r) Notify theOrderingPolicythat theSchedulableEntityhas been allocated the givenRMContainer, enabling theOrderingPolicyto take appropriate action.abstract voidcontainerReleased(S schedulableEntity, RMContainer r) Notify theOrderingPolicythat theSchedulableEntityhas released the givenRMContainer, enabling theOrderingPolicyto take appropriate action.abstract voiddemandUpdated(S schedulableEntity) Notify theOrderingPolicythat the demand for theSchedulableEntityhas been updated, enabling theOrderingPolicyto reorder theSchedulableEntityif needed.protected voidentityRequiresReordering(S schedulableEntity) Return an iterator over the collection ofSchedulableEntityobjects which orders them for container assignment.abstract StringReturn configuration name (which will be used to set ordering policy).abstract StringgetInfo()Return information regarding configuration and status.intGet the number ofSchedulableEntityobjects managed for allocation and preemption ordering.Return an iterator over the collection ofSchedulableEntityobjects which orders them for preemption.Get the collection ofSchedulableEntityObjects which are managed by this OrderingPolicy - should include processes returned by the Assignment and Preemption iterator with no guarantees regarding order.booleanRemove aSchedulableEntityfrom management for allocation and preemption ordering.protected voidreorderSchedulableEntity(S schedulableEntity) protected voidstatic void
-
Field Details
-
schedulableEntities
-
comparator
-
entitiesToReorder
-
-
Constructor Details
-
AbstractComparatorOrderingPolicy
public AbstractComparatorOrderingPolicy()
-
-
Method Details
-
getSchedulableEntities
Description copied from interface:OrderingPolicyGet the collection ofSchedulableEntityObjects which are managed by this OrderingPolicy - should include processes returned by the Assignment and Preemption iterator with no guarantees regarding order.- Specified by:
getSchedulableEntitiesin interfaceOrderingPolicy<S extends SchedulableEntity>- Returns:
- a collection of
SchedulableEntityobjects
-
getAssignmentIterator
Description copied from interface:OrderingPolicyReturn an iterator over the collection ofSchedulableEntityobjects which orders them for container assignment.- Specified by:
getAssignmentIteratorin interfaceOrderingPolicy<S extends SchedulableEntity>- Parameters:
sel- theIteratorSelectorto filter with- Returns:
- an iterator over the collection of
SchedulableEntityobjects
-
getPreemptionIterator
Description copied from interface:OrderingPolicyReturn an iterator over the collection ofSchedulableEntityobjects which orders them for preemption.- Specified by:
getPreemptionIteratorin interfaceOrderingPolicy<S extends SchedulableEntity>- Returns:
- an iterator over the collection of
SchedulableEntity
-
updateSchedulingResourceUsage
-
reorderSchedulableEntity
-
reorderScheduleEntities
protected void reorderScheduleEntities() -
entityRequiresReordering
-
getComparator
-
addSchedulableEntity
Description copied from interface:OrderingPolicyAdd aSchedulableEntityto be managed for allocation and preemption ordering.- Specified by:
addSchedulableEntityin interfaceOrderingPolicy<S extends SchedulableEntity>- Parameters:
s- theSchedulableEntityto add
-
removeSchedulableEntity
Description copied from interface:OrderingPolicyRemove aSchedulableEntityfrom management for allocation and preemption ordering.- Specified by:
removeSchedulableEntityin interfaceOrderingPolicy<S extends SchedulableEntity>- Parameters:
s- theSchedulableEntityto remove- Returns:
- whether the
SchedulableEntitywas present before this operation
-
addAllSchedulableEntities
Description copied from interface:OrderingPolicyAdd a collection ofSchedulableEntityobjects to be managed for allocation and preemption ordering.- Specified by:
addAllSchedulableEntitiesin interfaceOrderingPolicy<S extends SchedulableEntity>- Parameters:
sc- the collection ofSchedulableEntityobjects to add
-
getNumSchedulableEntities
public int getNumSchedulableEntities()Description copied from interface:OrderingPolicyGet the number ofSchedulableEntityobjects managed for allocation and preemption ordering.- Specified by:
getNumSchedulableEntitiesin interfaceOrderingPolicy<S extends SchedulableEntity>- Returns:
- the number of
SchedulableEntityobjects
-
configure
Description copied from interface:OrderingPolicyProvides configuration information for the policy from the scheduler configuration.- Specified by:
configurein interfaceOrderingPolicy<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>- 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>- 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>- Parameters:
schedulableEntity- the updatedSchedulableEntity
-
getInfo
Description copied from interface:OrderingPolicyReturn information regarding configuration and status.- Specified by:
getInfoin interfaceOrderingPolicy<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>- Returns:
- configuration name
-