public abstract class AbstractSchedulerPlanFollower extends Object implements PlanFollower
Modifier and Type | Field and Description |
---|---|
protected org.apache.hadoop.yarn.util.Clock |
clock |
protected Collection<Plan> |
plans |
protected YarnScheduler |
scheduler |
Constructor and Description |
---|
AbstractSchedulerPlanFollower() |
Modifier and Type | Method and Description |
---|---|
protected abstract void |
addReservationQueue(String planQueueName,
Queue queue,
String currResId)
Add a new reservation queue for reservation currResId for this planQueue.
|
protected void |
cleanupExpiredQueues(String planQueueName,
boolean shouldMove,
Set<String> toRemove,
String defReservationQueue)
First sets entitlement of queues to zero to prevent new app submission.
|
protected abstract void |
createDefaultReservationQueue(String planQueueName,
Queue queue,
String defReservationQueue)
Creates the default reservation queue for use when no reservation is used
for applications submitted to this planQueue.
|
protected abstract List<? extends Queue> |
getChildReservationQueues(Queue planQueue)
Get a list of reservation queues for this planQueue.
|
protected abstract Queue |
getPlanQueue(String planQueueName)
Get queue associated with reservable queue named.
|
protected abstract org.apache.hadoop.yarn.api.records.Resource |
getPlanResources(Plan plan,
Queue queue,
org.apache.hadoop.yarn.api.records.Resource clusterResources)
Get plan resources for this planQueue.
|
protected String |
getReservationIdFromQueueName(String resQueueName) |
protected String |
getReservationQueueName(String planQueueName,
String reservationId) |
protected abstract org.apache.hadoop.yarn.api.records.Resource |
getReservationQueueResourceIfExists(Plan plan,
org.apache.hadoop.yarn.api.records.ReservationId reservationId)
Get reservation queue resources if it exists otherwise return null.
|
protected int |
getReservedResources(long now,
Set<ReservationAllocation> currentReservations,
Set<String> curReservationNames,
org.apache.hadoop.yarn.api.records.Resource reservedResources) |
void |
init(org.apache.hadoop.yarn.util.Clock clock,
ResourceScheduler sched,
Collection<Plan> plans)
Init function that configures the PlanFollower, by providing:
|
void |
run() |
void |
setPlans(Collection<Plan> plans)
Setter for the list of plans.
|
protected void |
setQueueEntitlement(String planQueueName,
String currResId,
float targetCapacity,
float maxCapacity) |
protected List<ReservationAllocation> |
sortByDelta(List<ReservationAllocation> currentReservations,
long now,
Plan plan)
Sort in the order from the least new amount of resources asked (likely
negative) to the highest.
|
void |
synchronizePlan(Plan plan,
boolean shouldReplan)
The function performing the actual synchronization operation for a given
Plan.
|
protected Collection<Plan> plans
protected YarnScheduler scheduler
protected org.apache.hadoop.yarn.util.Clock clock
public void init(org.apache.hadoop.yarn.util.Clock clock, ResourceScheduler sched, Collection<Plan> plans)
PlanFollower
init
in interface PlanFollower
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.public void setPlans(Collection<Plan> plans)
PlanFollower
setPlans
in interface PlanFollower
plans
- the collection of Plans we operate on at every time tick.public void synchronizePlan(Plan plan, boolean shouldReplan)
PlanFollower
synchronizePlan
in interface PlanFollower
plan
- the Plan to synchronizeshouldReplan
- replan on reduction of plan capacity if true or
proportionally scale down reservations if falseprotected void setQueueEntitlement(String planQueueName, String currResId, float targetCapacity, float maxCapacity) throws org.apache.hadoop.yarn.exceptions.YarnException
org.apache.hadoop.yarn.exceptions.YarnException
protected String getReservationQueueName(String planQueueName, String reservationId)
protected void cleanupExpiredQueues(String planQueueName, boolean shouldMove, Set<String> toRemove, String defReservationQueue)
planQueueName
- the name of PlanQueue
shouldMove
- flag to indicate if any running apps should be moved or
killedtoRemove
- the remnant apps to clean updefReservationQueue
- the default ReservationQueue
of the
Plan
protected int getReservedResources(long now, Set<ReservationAllocation> currentReservations, Set<String> curReservationNames, org.apache.hadoop.yarn.api.records.Resource reservedResources)
protected List<ReservationAllocation> sortByDelta(List<ReservationAllocation> currentReservations, long now, Plan plan)
currentReservations
- the currently active reservationsnow
- the current timeplan
- the Plan
that is being consideredReservationAllocation
sprotected abstract Queue getPlanQueue(String planQueueName)
planQueueName
- name of the reservable queueprotected abstract List<? extends Queue> getChildReservationQueues(Queue planQueue)
planQueue
- the queue for the current Plan
protected abstract void addReservationQueue(String planQueueName, Queue queue, String currResId)
protected abstract void createDefaultReservationQueue(String planQueueName, Queue queue, String defReservationQueue)
planQueueName
- name of the reservable queuequeue
- the queue for the current Plan
defReservationQueue
- name of the default ReservationQueue
protected abstract org.apache.hadoop.yarn.api.records.Resource getPlanResources(Plan plan, Queue queue, org.apache.hadoop.yarn.api.records.Resource clusterResources)
protected abstract org.apache.hadoop.yarn.api.records.Resource getReservationQueueResourceIfExists(Plan plan, org.apache.hadoop.yarn.api.records.ReservationId reservationId)
plan
- the current Plan
being consideredreservationId
- the identifier of the reservationCopyright © 2008–2023 Apache Software Foundation. All rights reserved.