Type Parameters:
S - the type of SchedulableEntity that 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 Details

    • getSchedulableEntities

      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.
      Returns:
      a collection of SchedulableEntity objects
    • getAssignmentIterator

      Iterator<S> getAssignmentIterator(IteratorSelector sel)
      Return an iterator over the collection of SchedulableEntity objects which orders them for container assignment.
      Parameters:
      sel - the IteratorSelector to filter with
      Returns:
      an iterator over the collection of SchedulableEntity objects
    • getPreemptionIterator

      Iterator<S> getPreemptionIterator()
      Return an iterator over the collection of SchedulableEntity objects which orders them for preemption.
      Returns:
      an iterator over the collection of SchedulableEntity
    • addSchedulableEntity

      void addSchedulableEntity(S s)
      Add a SchedulableEntity to be managed for allocation and preemption ordering.
      Parameters:
      s - the SchedulableEntity to add
    • removeSchedulableEntity

      boolean removeSchedulableEntity(S s)
      Remove a SchedulableEntity from management for allocation and preemption ordering.
      Parameters:
      s - the SchedulableEntity to remove
      Returns:
      whether the SchedulableEntity was present before this operation
    • addAllSchedulableEntities

      void addAllSchedulableEntities(Collection<S> sc)
      Add a collection of SchedulableEntity objects to be managed for allocation and preemption ordering.
      Parameters:
      sc - the collection of SchedulableEntity objects to add
    • getNumSchedulableEntities

      int getNumSchedulableEntities()
      Get the number of SchedulableEntity objects managed for allocation and preemption ordering.
      Returns:
      the number of SchedulableEntity objects
    • configure

      void configure(Map<String,String> conf)
      Provides configuration information for the policy from the scheduler configuration.
      Parameters:
      conf - a map of scheduler configuration properties and values
    • containerAllocated

      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. Depending on the comparator, a reordering of the SchedulableEntity may be required.
      Parameters:
      schedulableEntity - the SchedulableEntity
      r - the allocated RMContainer
    • containerReleased

      void containerReleased(S schedulableEntity, RMContainer r)
      Notify the 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.
      Parameters:
      schedulableEntity - the SchedulableEntity
      r - the released RMContainer
    • demandUpdated

      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.
      Parameters:
      schedulableEntity - the updated SchedulableEntity
    • 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