Class AbstractReservationSystem

java.lang.Object
org.apache.hadoop.service.AbstractService
org.apache.hadoop.yarn.server.resourcemanager.reservation.AbstractReservationSystem
All Implemented Interfaces:
Closeable, AutoCloseable, org.apache.hadoop.service.Service, Recoverable, ReservationSystem
Direct Known Subclasses:
CapacityReservationSystem, FairReservationSystem

@LimitedPrivate("yarn") @Unstable public abstract class AbstractReservationSystem extends org.apache.hadoop.service.AbstractService implements ReservationSystem
This is the implementation of ReservationSystem based on the ResourceScheduler
  • Field Details

    • conf

      protected org.apache.hadoop.conf.Configuration conf
    • planStepSize

      protected long planStepSize
  • Constructor Details

    • AbstractReservationSystem

      public AbstractReservationSystem(String name)
      Construct the service.
      Parameters:
      name - service name
  • Method Details

    • setRMContext

      public void setRMContext(RMContext rmContext)
      Description copied from interface: ReservationSystem
      Set RMContext for ReservationSystem. This method should be called immediately after instantiating a reservation system once.
      Specified by:
      setRMContext in interface ReservationSystem
      Parameters:
      rmContext - created by ResourceManager
    • reinitialize

      public void reinitialize(org.apache.hadoop.conf.Configuration conf, RMContext rmContext) throws org.apache.hadoop.yarn.exceptions.YarnException
      Description copied from interface: ReservationSystem
      Re-initialize the ReservationSystem.
      Specified by:
      reinitialize in interface ReservationSystem
      Parameters:
      conf - configuration
      rmContext - current context of the ResourceManager
      Throws:
      org.apache.hadoop.yarn.exceptions.YarnException - if initialization of the configured plan fails
    • recover

      public void recover(RMStateStore.RMState state) throws Exception
      Specified by:
      recover in interface Recoverable
      Throws:
      Exception
    • getPlan

      public Plan getPlan(String planName)
      Description copied from interface: ReservationSystem
      Get an existing Plan that has been initialized.
      Specified by:
      getPlan in interface ReservationSystem
      Parameters:
      planName - the name of the Plan
      Returns:
      the Plan identified by name
    • getPlanFollowerTimeStep

      public long getPlanFollowerTimeStep()
      Description copied from interface: ReservationSystem
      Return the time step (ms) at which the PlanFollower is invoked
      Specified by:
      getPlanFollowerTimeStep in interface ReservationSystem
      Returns:
      the planStepSize
    • synchronizePlan

      public void synchronizePlan(String planName, boolean shouldReplan)
      Description copied from interface: ReservationSystem
      Invokes PlanFollower to synchronize the specified Plan with the ResourceScheduler
      Specified by:
      synchronizePlan in interface ReservationSystem
      Parameters:
      planName - the name of the Plan to be synchronized
      shouldReplan - replan on reduction of plan capacity if true or proportionally scale down reservations if false
    • serviceInit

      public void serviceInit(org.apache.hadoop.conf.Configuration conf) throws Exception
      Overrides:
      serviceInit in class org.apache.hadoop.service.AbstractService
      Throws:
      Exception
    • serviceStart

      public void serviceStart() throws Exception
      Overrides:
      serviceStart in class org.apache.hadoop.service.AbstractService
      Throws:
      Exception
    • serviceStop

      public void serviceStop()
      Overrides:
      serviceStop in class org.apache.hadoop.service.AbstractService
    • getQueueForReservation

      public String getQueueForReservation(org.apache.hadoop.yarn.api.records.ReservationId reservationId)
      Description copied from interface: ReservationSystem
      Get the Queue that an existing ReservationId is associated with.
      Specified by:
      getQueueForReservation in interface ReservationSystem
      Parameters:
      reservationId - the unique id of the reservation
      Returns:
      the name of the associated Queue
    • setQueueForReservation

      public void setQueueForReservation(org.apache.hadoop.yarn.api.records.ReservationId reservationId, String queueName)
      Description copied from interface: ReservationSystem
      Set the Queue that an existing ReservationId should be associated with.
      Specified by:
      setQueueForReservation in interface ReservationSystem
      Parameters:
      reservationId - the unique id of the reservation
      queueName - the name of Queue to associate the reservation with
    • getNewReservationId

      public org.apache.hadoop.yarn.api.records.ReservationId getNewReservationId()
      Description copied from interface: ReservationSystem
      Get a new unique ReservationId.
      Specified by:
      getNewReservationId in interface ReservationSystem
      Returns:
      a new unique ReservationId
    • getAllPlans

      public Map<String,Plan> getAllPlans()
      Description copied from interface: ReservationSystem
      Return a map containing all the plans known to this ReservationSystem (useful for UI)
      Specified by:
      getAllPlans in interface ReservationSystem
      Returns:
      a Map of Plan names and Plan objects
    • getDefaultReservationSystem

      public static String getDefaultReservationSystem(ResourceScheduler scheduler)
      Get the default reservation system corresponding to the scheduler
      Parameters:
      scheduler - the scheduler for which the reservation system is required
      Returns:
      the ReservationSystem based on the configured scheduler
    • initializePlan

      protected Plan initializePlan(String planQueueName) throws org.apache.hadoop.yarn.exceptions.YarnException
      Throws:
      org.apache.hadoop.yarn.exceptions.YarnException
    • getReplanner

      protected Planner getReplanner(String planQueueName)
    • getAgent

      protected ReservationAgent getAgent(String queueName)
    • getAdmissionPolicy

      protected SharingPolicy getAdmissionPolicy(String queueName)
    • getReservationsACLsManager

      public ReservationsACLsManager getReservationsACLsManager()
      Description copied from interface: ReservationSystem
      Get the ReservationsACLsManager to use to check for the reservation access on a user.
      Specified by:
      getReservationsACLsManager in interface ReservationSystem
      Returns:
      the reservation ACL manager to use to check reservation ACLs.
    • getReservationSchedulerConfiguration

      protected abstract ReservationSchedulerConfiguration getReservationSchedulerConfiguration()
    • getPlanQueuePath

      protected abstract String getPlanQueuePath(String planQueueName)
    • getPlanQueueCapacity

      protected abstract org.apache.hadoop.yarn.api.records.Resource getPlanQueueCapacity(String planQueueName)
    • getMinAllocation

      protected abstract org.apache.hadoop.yarn.api.records.Resource getMinAllocation()
    • getMaxAllocation

      protected abstract org.apache.hadoop.yarn.api.records.Resource getMaxAllocation()
    • getResourceCalculator

      protected abstract org.apache.hadoop.yarn.util.resource.ResourceCalculator getResourceCalculator()
    • getRootQueueMetrics

      protected abstract QueueMetrics getRootQueueMetrics()