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-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.hadoop.service.Service
org.apache.hadoop.service.Service.STATE -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected org.apache.hadoop.conf.Configurationprotected long -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected SharingPolicygetAdmissionPolicy(String queueName) protected ReservationAgentReturn a map containing all the plans known to this ReservationSystem (useful for UI)static StringgetDefaultReservationSystem(ResourceScheduler scheduler) Get the default reservation system corresponding to the schedulerprotected abstract org.apache.hadoop.yarn.api.records.Resourceprotected abstract org.apache.hadoop.yarn.api.records.Resourceorg.apache.hadoop.yarn.api.records.ReservationIdGet a new uniqueReservationId.Get an existingPlanthat has been initialized.longReturn the time step (ms) at which thePlanFolloweris invokedprotected abstract org.apache.hadoop.yarn.api.records.ResourcegetPlanQueueCapacity(String planQueueName) protected abstract StringgetPlanQueuePath(String planQueueName) getQueueForReservation(org.apache.hadoop.yarn.api.records.ReservationId reservationId) Get theQueuethat an existingReservationIdis associated with.protected PlannergetReplanner(String planQueueName) Get theReservationsACLsManagerto use to check for the reservation access on a user.protected abstract ReservationSchedulerConfigurationprotected abstract org.apache.hadoop.yarn.util.resource.ResourceCalculatorprotected abstract QueueMetricsprotected PlaninitializePlan(String planQueueName) voidrecover(RMStateStore.RMState state) voidreinitialize(org.apache.hadoop.conf.Configuration conf, RMContext rmContext) Re-initialize theReservationSystem.voidserviceInit(org.apache.hadoop.conf.Configuration conf) voidvoidvoidsetQueueForReservation(org.apache.hadoop.yarn.api.records.ReservationId reservationId, String queueName) Set theQueuethat an existingReservationIdshould be associated with.voidsetRMContext(RMContext rmContext) Set RMContext forReservationSystem.voidsynchronizePlan(String planName, boolean shouldReplan) Methods inherited from class org.apache.hadoop.service.AbstractService
close, getBlockers, getConfig, getFailureCause, getFailureState, getLifecycleHistory, getName, getServiceState, getStartTime, init, isInState, noteFailure, putBlocker, registerGlobalListener, registerServiceListener, removeBlocker, setConfig, start, stop, toString, unregisterGlobalListener, unregisterServiceListener, waitForServiceToStop
-
Field Details
-
conf
protected org.apache.hadoop.conf.Configuration conf -
planStepSize
protected long planStepSize
-
-
Constructor Details
-
AbstractReservationSystem
Construct the service.- Parameters:
name- service name
-
-
Method Details
-
setRMContext
Description copied from interface:ReservationSystemSet RMContext forReservationSystem. This method should be called immediately after instantiating a reservation system once.- Specified by:
setRMContextin interfaceReservationSystem- Parameters:
rmContext- created byResourceManager
-
reinitialize
public void reinitialize(org.apache.hadoop.conf.Configuration conf, RMContext rmContext) throws org.apache.hadoop.yarn.exceptions.YarnException Description copied from interface:ReservationSystemRe-initialize theReservationSystem.- Specified by:
reinitializein interfaceReservationSystem- Parameters:
conf- configurationrmContext- current context of theResourceManager- Throws:
org.apache.hadoop.yarn.exceptions.YarnException- if initialization of the configured plan fails
-
recover
- Specified by:
recoverin interfaceRecoverable- Throws:
Exception
-
getPlan
Description copied from interface:ReservationSystemGet an existingPlanthat has been initialized.- Specified by:
getPlanin interfaceReservationSystem- Parameters:
planName- the name of thePlan- Returns:
- the
Planidentified by name
-
getPlanFollowerTimeStep
public long getPlanFollowerTimeStep()Description copied from interface:ReservationSystemReturn the time step (ms) at which thePlanFolloweris invoked- Specified by:
getPlanFollowerTimeStepin interfaceReservationSystem- Returns:
- the planStepSize
-
synchronizePlan
Description copied from interface:ReservationSystem- Specified by:
synchronizePlanin interfaceReservationSystem- Parameters:
planName- the name of thePlanto be synchronizedshouldReplan- replan on reduction of plan capacity if true or proportionally scale down reservations if false
-
serviceInit
- Overrides:
serviceInitin classorg.apache.hadoop.service.AbstractService- Throws:
Exception
-
serviceStart
- Overrides:
serviceStartin classorg.apache.hadoop.service.AbstractService- Throws:
Exception
-
serviceStop
public void serviceStop()- Overrides:
serviceStopin classorg.apache.hadoop.service.AbstractService
-
getQueueForReservation
public String getQueueForReservation(org.apache.hadoop.yarn.api.records.ReservationId reservationId) Description copied from interface:ReservationSystemGet theQueuethat an existingReservationIdis associated with.- Specified by:
getQueueForReservationin interfaceReservationSystem- 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:ReservationSystemSet theQueuethat an existingReservationIdshould be associated with.- Specified by:
setQueueForReservationin interfaceReservationSystem- Parameters:
reservationId- the unique id of the reservationqueueName- the name of Queue to associate the reservation with
-
getNewReservationId
public org.apache.hadoop.yarn.api.records.ReservationId getNewReservationId()Description copied from interface:ReservationSystemGet a new uniqueReservationId.- Specified by:
getNewReservationIdin interfaceReservationSystem- Returns:
- a new unique
ReservationId
-
getAllPlans
Description copied from interface:ReservationSystemReturn a map containing all the plans known to this ReservationSystem (useful for UI)- Specified by:
getAllPlansin interfaceReservationSystem- Returns:
- a Map of Plan names and Plan objects
-
getDefaultReservationSystem
Get the default reservation system corresponding to the scheduler- Parameters:
scheduler- the scheduler for which the reservation system is required- Returns:
- the
ReservationSystembased 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
-
getAgent
-
getAdmissionPolicy
-
getReservationsACLsManager
Description copied from interface:ReservationSystemGet theReservationsACLsManagerto use to check for the reservation access on a user.- Specified by:
getReservationsACLsManagerin interfaceReservationSystem- Returns:
- the reservation ACL manager to use to check reservation ACLs.
-
getReservationSchedulerConfiguration
-
getPlanQueuePath
-
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
-