Class IterativePlanner
java.lang.Object
org.apache.hadoop.yarn.server.resourcemanager.reservation.planning.PlanningAlgorithm
org.apache.hadoop.yarn.server.resourcemanager.reservation.planning.IterativePlanner
- All Implemented Interfaces:
ReservationAgent
A planning algorithm consisting of two main phases. The algorithm iterates
over the job stages in ascending/descending order, depending on the flag
allocateLeft. For each stage, the algorithm: 1. Determines an interval
[stageArrival, stageDeadline) in which the stage is allocated. 2. Computes an
allocation for the stage inside the interval. For ANY and ALL jobs, phase 1
sets the allocation window of each stage to be [jobArrival, jobDeadline]. For
ORDER and ORDER_NO_GAP jobs, the deadline of each stage is set as
succcessorStartTime - the starting time of its succeeding stage (or
jobDeadline if it is the last stage). The phases are set using the two
functions: 1. setAlgStageExecutionInterval 2.setAlgStageAllocator
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classHelper class that provide a list of ReservationRequests and iterates forward or backward depending whether we are allocating left-to-right or right-to-left. -
Field Summary
Fields inherited from interface org.apache.hadoop.yarn.server.resourcemanager.reservation.planning.ReservationAgent
DEFAULT_GREEDY_FAVOR_EARLY_ALLOCATION, FAVOR_EARLY_ALLOCATION -
Constructor Summary
ConstructorsConstructorDescriptionIterativePlanner(StageExecutionInterval algStageExecutionInterval, StageAllocator algStageAllocator, boolean allocateLeft) -
Method Summary
Modifier and TypeMethodDescriptioncomputeJobAllocation(Plan plan, org.apache.hadoop.yarn.api.records.ReservationId reservationId, org.apache.hadoop.yarn.api.records.ReservationDefinition reservation, String user) protected Map<ReservationInterval,org.apache.hadoop.yarn.api.records.Resource> computeStageAllocation(Plan plan, org.apache.hadoop.yarn.api.records.ReservationRequest rr, long stageArrivalTime, long stageDeadline, long period, String user, org.apache.hadoop.yarn.api.records.ReservationId oldId) protected voidinitialize(Plan plan, org.apache.hadoop.yarn.api.records.ReservationId reservationId, org.apache.hadoop.yarn.api.records.ReservationDefinition reservation) protected ReservationIntervalsetStageExecutionInterval(Plan plan, org.apache.hadoop.yarn.api.records.ReservationDefinition reservation, org.apache.hadoop.yarn.api.records.ReservationRequest currentReservationStage, RLESparseResourceAllocation allocations) protected static booleanvalidateOrderNoGap(RLESparseResourceAllocation allocations, Map<ReservationInterval, org.apache.hadoop.yarn.api.records.Resource> curAlloc, boolean allocateLeft) Methods inherited from class org.apache.hadoop.yarn.server.resourcemanager.reservation.planning.PlanningAlgorithm
allocateUser, createReservation, deleteReservation, findEarliestTime, findLatestTime, init, stepRoundDown, stepRoundUp, updateReservation
-
Constructor Details
-
IterativePlanner
public IterativePlanner(StageExecutionInterval algStageExecutionInterval, StageAllocator algStageAllocator, boolean allocateLeft)
-
-
Method Details
-
computeJobAllocation
public RLESparseResourceAllocation computeJobAllocation(Plan plan, org.apache.hadoop.yarn.api.records.ReservationId reservationId, org.apache.hadoop.yarn.api.records.ReservationDefinition reservation, String user) throws PlanningException - Specified by:
computeJobAllocationin classPlanningAlgorithm- Throws:
PlanningException
-
validateOrderNoGap
protected static boolean validateOrderNoGap(RLESparseResourceAllocation allocations, Map<ReservationInterval, org.apache.hadoop.yarn.api.records.Resource> curAlloc, boolean allocateLeft) -
initialize
protected void initialize(Plan plan, org.apache.hadoop.yarn.api.records.ReservationId reservationId, org.apache.hadoop.yarn.api.records.ReservationDefinition reservation) throws PlanningException - Throws:
PlanningException
-
setStageExecutionInterval
protected ReservationInterval setStageExecutionInterval(Plan plan, org.apache.hadoop.yarn.api.records.ReservationDefinition reservation, org.apache.hadoop.yarn.api.records.ReservationRequest currentReservationStage, RLESparseResourceAllocation allocations) -
computeStageAllocation
protected Map<ReservationInterval,org.apache.hadoop.yarn.api.records.Resource> computeStageAllocation(Plan plan, org.apache.hadoop.yarn.api.records.ReservationRequest rr, long stageArrivalTime, long stageDeadline, long period, String user, org.apache.hadoop.yarn.api.records.ReservationId oldId) throws PlanningException - Throws:
PlanningException
-
setAlgStageExecutionInterval
-
setAlgStageAllocator
-