Interface OrderingPolicy<S extends SchedulableEntity>
- Type Parameters:
S- the type ofSchedulableEntitythat will be compared
- All Known Implementing Classes:
AbstractComparatorOrderingPolicy,FairOrderingPolicy,FifoOrderingPolicy,FifoOrderingPolicyForPendingApps,FifoOrderingPolicyWithExclusivePartitions
public interface OrderingPolicy<S extends SchedulableEntity>
OrderingPolicy is used by the scheduler to order SchedulableEntities for
container assignment and preemption.
-
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.voidProvides 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 an iterator over the collection ofSchedulableEntityobjects which orders them for container assignment.Return configuration name (which will be used to set ordering policy).getInfo()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.
-
Method Details
-
getSchedulableEntities
Collection<S> getSchedulableEntities()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.- Returns:
- a collection of
SchedulableEntityobjects
-
getAssignmentIterator
Return an iterator over the collection ofSchedulableEntityobjects which orders them for container assignment.- Parameters:
sel- theIteratorSelectorto filter with- Returns:
- an iterator over the collection of
SchedulableEntityobjects
-
getPreemptionIterator
Return an iterator over the collection ofSchedulableEntityobjects which orders them for preemption.- Returns:
- an iterator over the collection of
SchedulableEntity
-
addSchedulableEntity
Add aSchedulableEntityto be managed for allocation and preemption ordering.- Parameters:
s- theSchedulableEntityto add
-
removeSchedulableEntity
Remove aSchedulableEntityfrom management for allocation and preemption ordering.- Parameters:
s- theSchedulableEntityto remove- Returns:
- whether the
SchedulableEntitywas present before this operation
-
addAllSchedulableEntities
Add a collection ofSchedulableEntityobjects to be managed for allocation and preemption ordering.- Parameters:
sc- the collection ofSchedulableEntityobjects to add
-
getNumSchedulableEntities
int getNumSchedulableEntities()Get the number ofSchedulableEntityobjects managed for allocation and preemption ordering.- Returns:
- the number of
SchedulableEntityobjects
-
configure
Provides configuration information for the policy from the scheduler configuration.- Parameters:
conf- a map of scheduler configuration properties and values
-
containerAllocated
Notify theOrderingPolicythat theSchedulableEntityhas been allocated the givenRMContainer, enabling theOrderingPolicyto take appropriate action. Depending on the comparator, a reordering of theSchedulableEntitymay be required.- Parameters:
schedulableEntity- theSchedulableEntityr- the allocatedRMContainer
-
containerReleased
Notify theOrderingPolicythat theSchedulableEntityhas released the givenRMContainer, enabling theOrderingPolicyto take appropriate action. Depending on the comparator, a reordering of theSchedulableEntitymay be required.- Parameters:
schedulableEntity- theSchedulableEntityr- the releasedRMContainer
-
demandUpdated
Notify theOrderingPolicythat the demand for theSchedulableEntityhas been updated, enabling theOrderingPolicyto reorder theSchedulableEntityif needed.- Parameters:
schedulableEntity- the updatedSchedulableEntity
-
getInfo
String getInfo()Return information regarding configuration and status.- Returns:
- configuration and status information
-
getConfigName
String getConfigName()Return configuration name (which will be used to set ordering policy).- Returns:
- configuration name
-