Class CapacitySchedulerPlanFollower

java.lang.Object
org.apache.hadoop.yarn.server.resourcemanager.reservation.AbstractSchedulerPlanFollower
org.apache.hadoop.yarn.server.resourcemanager.reservation.CapacitySchedulerPlanFollower
All Implemented Interfaces:
Runnable, PlanFollower

public class CapacitySchedulerPlanFollower extends AbstractSchedulerPlanFollower
This class implements a PlanFollower. This is invoked on a timer, and it is in charge to publish the state of the Plans to the underlying CapacityScheduler. This implementation does so, by adding/removing/resizing leaf queues in the scheduler, thus affecting the dynamic behavior of the scheduler in a way that is consistent with the content of the plan. It also updates the plan's view on how much resources are available in the cluster. This implementation of PlanFollower is relatively stateless, and it can synchronize schedulers and Plans that have arbitrary changes (performing set differences among existing queues). This makes it resilient to frequency of synchronization, and RM restart issues (no "catch up" is necessary).
  • Constructor Details

    • CapacitySchedulerPlanFollower

      public CapacitySchedulerPlanFollower()
  • Method Details

    • init

      public void init(org.apache.hadoop.yarn.util.Clock clock, ResourceScheduler sched, Collection<Plan> plans)
      Description copied from interface: PlanFollower
      Init function that configures the PlanFollower, by providing:
      Specified by:
      init in interface PlanFollower
      Overrides:
      init in class AbstractSchedulerPlanFollower
      Parameters:
      clock - a reference to the system clock.
      sched - a reference to the underlying scheduler
      plans - references to the plans we should keep synchronized at every time tick.
    • getPlanQueue

      protected Queue getPlanQueue(String planQueueName)
      Description copied from class: AbstractSchedulerPlanFollower
      Get queue associated with reservable queue named.
      Specified by:
      getPlanQueue in class AbstractSchedulerPlanFollower
      Parameters:
      planQueueName - name of the reservable queue
      Returns:
      queue associated with the reservable queue
    • getChildReservationQueues

      protected List<? extends Queue> getChildReservationQueues(Queue queue)
      Description copied from class: AbstractSchedulerPlanFollower
      Get a list of reservation queues for this planQueue.
      Specified by:
      getChildReservationQueues in class AbstractSchedulerPlanFollower
      Parameters:
      queue - the queue for the current Plan
      Returns:
      the queues corresponding to the reservations
    • addReservationQueue

      protected void addReservationQueue(String planQueueName, Queue queue, String currResId)
      Description copied from class: AbstractSchedulerPlanFollower
      Add a new reservation queue for reservation currResId for this planQueue.
      Specified by:
      addReservationQueue in class AbstractSchedulerPlanFollower
      Parameters:
      planQueueName - name of the reservable queue.
      queue - the queue for the current Plan.
      currResId - curr reservationId.
    • createDefaultReservationQueue

      protected void createDefaultReservationQueue(String planQueueName, Queue queue, String defReservationId)
      Description copied from class: AbstractSchedulerPlanFollower
      Creates the default reservation queue for use when no reservation is used for applications submitted to this planQueue.
      Specified by:
      createDefaultReservationQueue in class AbstractSchedulerPlanFollower
      Parameters:
      planQueueName - name of the reservable queue
      queue - the queue for the current Plan
      defReservationId - name of the default ReservationQueue
    • getPlanResources

      protected org.apache.hadoop.yarn.api.records.Resource getPlanResources(Plan plan, Queue queue, org.apache.hadoop.yarn.api.records.Resource clusterResources)
      Description copied from class: AbstractSchedulerPlanFollower
      Get plan resources for this planQueue.
      Specified by:
      getPlanResources in class AbstractSchedulerPlanFollower
      Parameters:
      plan - the current Plan being considered
      queue - the queue for the current Plan
      clusterResources - the resources available in the cluster
      Returns:
      the resources allocated to the specified Plan
    • getReservationQueueResourceIfExists

      protected org.apache.hadoop.yarn.api.records.Resource getReservationQueueResourceIfExists(Plan plan, org.apache.hadoop.yarn.api.records.ReservationId reservationId)
      Description copied from class: AbstractSchedulerPlanFollower
      Get reservation queue resources if it exists otherwise return null.
      Specified by:
      getReservationQueueResourceIfExists in class AbstractSchedulerPlanFollower
      Parameters:
      plan - the current Plan being considered
      reservationId - the identifier of the reservation
      Returns:
      the resources allocated to the specified reservation