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
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).-
Field Summary
Fields inherited from class org.apache.hadoop.yarn.server.resourcemanager.reservation.AbstractSchedulerPlanFollower
clock, plans, scheduler -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddReservationQueue(String planQueueName, Queue queue, String currResId) Add a new reservation queue for reservation currResId for this planQueue.protected voidcreateDefaultReservationQueue(String planQueueName, Queue queue, String defReservationId) Creates the default reservation queue for use when no reservation is used for applications submitted to this planQueue.getChildReservationQueues(Queue queue) Get a list of reservation queues for this planQueue.protected QueuegetPlanQueue(String planQueueName) Get queue associated with reservable queue named.protected org.apache.hadoop.yarn.api.records.ResourcegetPlanResources(Plan plan, Queue queue, org.apache.hadoop.yarn.api.records.Resource clusterResources) Get plan resources for this planQueue.protected org.apache.hadoop.yarn.api.records.ResourcegetReservationQueueResourceIfExists(Plan plan, org.apache.hadoop.yarn.api.records.ReservationId reservationId) Get reservation queue resources if it exists otherwise return null.voidinit(org.apache.hadoop.yarn.util.Clock clock, ResourceScheduler sched, Collection<Plan> plans) Init function that configures the PlanFollower, by providing:Methods inherited from class org.apache.hadoop.yarn.server.resourcemanager.reservation.AbstractSchedulerPlanFollower
cleanupExpiredQueues, getReservationIdFromQueueName, getReservationQueueName, getReservedResources, run, setPlans, setQueueEntitlement, sortByDelta, synchronizePlan
-
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:PlanFollowerInit function that configures the PlanFollower, by providing:- Specified by:
initin interfacePlanFollower- Overrides:
initin classAbstractSchedulerPlanFollower- Parameters:
clock- a reference to the system clock.sched- a reference to the underlying schedulerplans- references to the plans we should keep synchronized at every time tick.
-
getPlanQueue
Description copied from class:AbstractSchedulerPlanFollowerGet queue associated with reservable queue named.- Specified by:
getPlanQueuein classAbstractSchedulerPlanFollower- Parameters:
planQueueName- name of the reservable queue- Returns:
- queue associated with the reservable queue
-
getChildReservationQueues
Description copied from class:AbstractSchedulerPlanFollowerGet a list of reservation queues for this planQueue.- Specified by:
getChildReservationQueuesin classAbstractSchedulerPlanFollower- Parameters:
queue- the queue for the currentPlan- Returns:
- the queues corresponding to the reservations
-
addReservationQueue
Description copied from class:AbstractSchedulerPlanFollowerAdd a new reservation queue for reservation currResId for this planQueue.- Specified by:
addReservationQueuein classAbstractSchedulerPlanFollower- Parameters:
planQueueName- name of the reservable queue.queue- the queue for the currentPlan.currResId- curr reservationId.
-
createDefaultReservationQueue
protected void createDefaultReservationQueue(String planQueueName, Queue queue, String defReservationId) Description copied from class:AbstractSchedulerPlanFollowerCreates the default reservation queue for use when no reservation is used for applications submitted to this planQueue.- Specified by:
createDefaultReservationQueuein classAbstractSchedulerPlanFollower- Parameters:
planQueueName- name of the reservable queuequeue- the queue for the currentPlandefReservationId- name of the defaultReservationQueue
-
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:AbstractSchedulerPlanFollowerGet plan resources for this planQueue.- Specified by:
getPlanResourcesin classAbstractSchedulerPlanFollower- Parameters:
plan- the currentPlanbeing consideredqueue- the queue for the currentPlanclusterResources- 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:AbstractSchedulerPlanFollowerGet reservation queue resources if it exists otherwise return null.- Specified by:
getReservationQueueResourceIfExistsin classAbstractSchedulerPlanFollower- Parameters:
plan- the currentPlanbeing consideredreservationId- the identifier of the reservation- Returns:
- the resources allocated to the specified reservation
-