public abstract class AbstractComparatorOrderingPolicy<S extends SchedulableEntity> extends Object implements OrderingPolicy<S>
Modifier and Type | Field and Description |
---|---|
protected Comparator<SchedulableEntity> |
comparator |
protected Map<String,S> |
entitiesToReorder |
protected ConcurrentSkipListSet<S> |
schedulableEntities |
Constructor and Description |
---|
AbstractComparatorOrderingPolicy() |
Modifier and Type | Method and Description |
---|---|
void |
addAllSchedulableEntities(Collection<S> sc)
Add a collection of
SchedulableEntity objects to be managed for
allocation and preemption ordering. |
void |
addSchedulableEntity(S s)
Add a
SchedulableEntity to be managed for allocation and preemption
ordering. |
abstract void |
configure(Map<String,String> conf)
Provides configuration information for the policy from the scheduler
configuration.
|
abstract void |
containerAllocated(S schedulableEntity,
RMContainer r)
Notify the
OrderingPolicy that the SchedulableEntity
has been allocated the given RMContainer , enabling the
OrderingPolicy to take appropriate action. |
abstract void |
containerReleased(S schedulableEntity,
RMContainer r)
Notify the
OrderingPolicy that the SchedulableEntity
has released the given RMContainer , enabling the
OrderingPolicy to take appropriate action. |
abstract void |
demandUpdated(S schedulableEntity)
Notify the
OrderingPolicy that the demand for the
SchedulableEntity has been updated, enabling the
OrderingPolicy to reorder the SchedulableEntity if needed. |
protected void |
entityRequiresReordering(S schedulableEntity) |
Iterator<S> |
getAssignmentIterator(IteratorSelector sel)
Return an iterator over the collection of
SchedulableEntity
objects which orders them for container assignment. |
Comparator<SchedulableEntity> |
getComparator() |
abstract String |
getConfigName()
Return configuration name (which will be used to set ordering policy).
|
abstract String |
getInfo()
Return information regarding configuration and status.
|
int |
getNumSchedulableEntities()
Get the number of
SchedulableEntity objects managed for allocation
and preemption ordering. |
Iterator<S> |
getPreemptionIterator()
Return an iterator over the collection of
SchedulableEntity
objects which orders them for preemption. |
Collection<S> |
getSchedulableEntities()
Get the collection of
SchedulableEntity Objects which are managed
by this OrderingPolicy - should include processes returned by the
Assignment and Preemption iterator with no guarantees regarding order. |
boolean |
removeSchedulableEntity(S s)
Remove a
SchedulableEntity from management for allocation and
preemption ordering. |
protected void |
reorderSchedulableEntity(S schedulableEntity) |
protected void |
reorderScheduleEntities() |
static void |
updateSchedulingResourceUsage(ResourceUsage ru) |
protected ConcurrentSkipListSet<S extends SchedulableEntity> schedulableEntities
protected Comparator<SchedulableEntity> comparator
protected Map<String,S extends SchedulableEntity> entitiesToReorder
public Collection<S> getSchedulableEntities()
OrderingPolicy
SchedulableEntity
Objects which are managed
by this OrderingPolicy - should include processes returned by the
Assignment and Preemption iterator with no guarantees regarding order.getSchedulableEntities
in interface OrderingPolicy<S extends SchedulableEntity>
SchedulableEntity
objectspublic Iterator<S> getAssignmentIterator(IteratorSelector sel)
OrderingPolicy
SchedulableEntity
objects which orders them for container assignment.getAssignmentIterator
in interface OrderingPolicy<S extends SchedulableEntity>
sel
- the IteratorSelector
to filter withSchedulableEntity
objectspublic Iterator<S> getPreemptionIterator()
OrderingPolicy
SchedulableEntity
objects which orders them for preemption.getPreemptionIterator
in interface OrderingPolicy<S extends SchedulableEntity>
SchedulableEntity
public static void updateSchedulingResourceUsage(ResourceUsage ru)
protected void reorderSchedulableEntity(S schedulableEntity)
protected void reorderScheduleEntities()
protected void entityRequiresReordering(S schedulableEntity)
public Comparator<SchedulableEntity> getComparator()
public void addSchedulableEntity(S s)
OrderingPolicy
SchedulableEntity
to be managed for allocation and preemption
ordering.addSchedulableEntity
in interface OrderingPolicy<S extends SchedulableEntity>
s
- the SchedulableEntity
to addpublic boolean removeSchedulableEntity(S s)
OrderingPolicy
SchedulableEntity
from management for allocation and
preemption ordering.removeSchedulableEntity
in interface OrderingPolicy<S extends SchedulableEntity>
s
- the SchedulableEntity
to removeSchedulableEntity
was present before this
operationpublic void addAllSchedulableEntities(Collection<S> sc)
OrderingPolicy
SchedulableEntity
objects to be managed for
allocation and preemption ordering.addAllSchedulableEntities
in interface OrderingPolicy<S extends SchedulableEntity>
sc
- the collection of SchedulableEntity
objects to addpublic int getNumSchedulableEntities()
OrderingPolicy
SchedulableEntity
objects managed for allocation
and preemption ordering.getNumSchedulableEntities
in interface OrderingPolicy<S extends SchedulableEntity>
SchedulableEntity
objectspublic abstract void configure(Map<String,String> conf)
OrderingPolicy
configure
in interface OrderingPolicy<S extends SchedulableEntity>
conf
- a map of scheduler configuration properties and valuespublic abstract void containerAllocated(S schedulableEntity, RMContainer r)
OrderingPolicy
OrderingPolicy
that the SchedulableEntity
has been allocated the given RMContainer
, enabling the
OrderingPolicy
to take appropriate action. Depending on the
comparator, a reordering of the SchedulableEntity
may be required.containerAllocated
in interface OrderingPolicy<S extends SchedulableEntity>
schedulableEntity
- the SchedulableEntity
r
- the allocated RMContainer
public abstract void containerReleased(S schedulableEntity, RMContainer r)
OrderingPolicy
OrderingPolicy
that the SchedulableEntity
has released the given RMContainer
, enabling the
OrderingPolicy
to take appropriate action. Depending on the
comparator, a reordering of the SchedulableEntity
may be required.containerReleased
in interface OrderingPolicy<S extends SchedulableEntity>
schedulableEntity
- the SchedulableEntity
r
- the released RMContainer
public abstract void demandUpdated(S schedulableEntity)
OrderingPolicy
OrderingPolicy
that the demand for the
SchedulableEntity
has been updated, enabling the
OrderingPolicy
to reorder the SchedulableEntity
if needed.demandUpdated
in interface OrderingPolicy<S extends SchedulableEntity>
schedulableEntity
- the updated SchedulableEntity
public abstract String getInfo()
OrderingPolicy
getInfo
in interface OrderingPolicy<S extends SchedulableEntity>
public abstract String getConfigName()
OrderingPolicy
getConfigName
in interface OrderingPolicy<S extends SchedulableEntity>
Copyright © 2008–2023 Apache Software Foundation. All rights reserved.