Class StageAllocatorLowCostAligned
java.lang.Object
org.apache.hadoop.yarn.server.resourcemanager.reservation.planning.StageAllocatorLowCostAligned
- All Implemented Interfaces:
StageAllocator
A stage allocator that iteratively allocates containers in the
StageAllocatorLowCostAligned.DurationInterval with lowest overall cost. The algorithm only
considers non-overlapping intervals of length 'duration'. This guarantees
that the allocations are aligned. If 'allocateLeft == true', the intervals
considered by the algorithm are aligned to stageArrival; otherwise, they are
aligned to stageDeadline. The smoothnessFactor parameter controls the number
of containers that are simultaneously allocated in each iteration of the
algorithm.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static classAn inner class that represents an interval, typically of length duration. -
Constructor Summary
ConstructorsConstructorDescriptionStageAllocatorLowCostAligned(boolean allocateLeft) StageAllocatorLowCostAligned(int smoothnessFactor, boolean allocateLeft) -
Method Summary
Modifier and TypeMethodDescriptionprotected doublecalcCostOfInterval(long startTime, long endTime, RLESparseResourceAllocation planLoads, RLESparseResourceAllocation planModifications, org.apache.hadoop.yarn.api.records.Resource capacity, org.apache.hadoop.yarn.util.resource.ResourceCalculator resCalc, long step) protected static doublecalcCostOfLoad(org.apache.hadoop.yarn.api.records.Resource load, org.apache.hadoop.yarn.api.records.Resource capacity, org.apache.hadoop.yarn.util.resource.ResourceCalculator resCalc) protected doublecalcCostOfTimeSlot(long t, RLESparseResourceAllocation planLoads, RLESparseResourceAllocation planModifications, org.apache.hadoop.yarn.api.records.Resource capacity, org.apache.hadoop.yarn.util.resource.ResourceCalculator resCalc) Map<ReservationInterval,org.apache.hadoop.yarn.api.records.Resource> computeStageAllocation(Plan plan, RLESparseResourceAllocation planLoads, RLESparseResourceAllocation planModifications, org.apache.hadoop.yarn.api.records.ReservationRequest rr, long stageArrival, long stageDeadline, long period, String user, org.apache.hadoop.yarn.api.records.ReservationId oldId) Computes the allocation of a stage inside a defined time interval.protected static StageAllocatorLowCostAligned.DurationIntervalgetDurationInterval(long startTime, long endTime, RLESparseResourceAllocation planLoads, RLESparseResourceAllocation planModifications, org.apache.hadoop.yarn.api.records.Resource capacity, RLESparseResourceAllocation netRLERes, org.apache.hadoop.yarn.util.resource.ResourceCalculator resCalc, long step, org.apache.hadoop.yarn.api.records.Resource requestedResources) protected static intgetDurationIntervalGangsCanFit(long startTime, long endTime, RLESparseResourceAllocation planModifications, org.apache.hadoop.yarn.api.records.Resource capacity, RLESparseResourceAllocation netRLERes, org.apache.hadoop.yarn.util.resource.ResourceCalculator resCalc, org.apache.hadoop.yarn.api.records.Resource requestedResources) protected static doublegetDurationIntervalTotalCost(long startTime, long endTime, RLESparseResourceAllocation planLoads, RLESparseResourceAllocation planModifications, org.apache.hadoop.yarn.api.records.Resource capacity, org.apache.hadoop.yarn.util.resource.ResourceCalculator resCalc, long step) protected org.apache.hadoop.yarn.api.records.ResourcegetLoadAtTime(long t, RLESparseResourceAllocation planLoads, RLESparseResourceAllocation planModifications) protected static longstepRoundDown(long t, long step) protected static longstepRoundUp(long t, long step)
-
Constructor Details
-
StageAllocatorLowCostAligned
public StageAllocatorLowCostAligned(boolean allocateLeft) -
StageAllocatorLowCostAligned
public StageAllocatorLowCostAligned(int smoothnessFactor, boolean allocateLeft)
-
-
Method Details
-
computeStageAllocation
public Map<ReservationInterval,org.apache.hadoop.yarn.api.records.Resource> computeStageAllocation(Plan plan, RLESparseResourceAllocation planLoads, RLESparseResourceAllocation planModifications, org.apache.hadoop.yarn.api.records.ReservationRequest rr, long stageArrival, long stageDeadline, long period, String user, org.apache.hadoop.yarn.api.records.ReservationId oldId) throws PlanningException Description copied from interface:StageAllocatorComputes the allocation of a stage inside a defined time interval.- Specified by:
computeStageAllocationin interfaceStageAllocator- Parameters:
plan- the Plan to which the reservation must be fittedplanLoads- a 'dirty' read of the plan loads at each timeplanModifications- the allocations performed by the planning algorithm which are not yet reflected by planrr- the stagestageArrival- the arrival time (earliest starting time) set for the stage by the two phase planning algorithmstageDeadline- the deadline of the stage set by the two phase planning algorithmperiod- the periodicity with which this stage appearsuser- name of the useroldId- identifier of the old reservation- Returns:
- The computed allocation (or null if the stage could not be allocated)
- Throws:
PlanningException- if operation is unsuccessful
-
getDurationInterval
protected static StageAllocatorLowCostAligned.DurationInterval getDurationInterval(long startTime, long endTime, RLESparseResourceAllocation planLoads, RLESparseResourceAllocation planModifications, org.apache.hadoop.yarn.api.records.Resource capacity, RLESparseResourceAllocation netRLERes, org.apache.hadoop.yarn.util.resource.ResourceCalculator resCalc, long step, org.apache.hadoop.yarn.api.records.Resource requestedResources) throws PlanningException - Throws:
PlanningException
-
getDurationIntervalTotalCost
protected static double getDurationIntervalTotalCost(long startTime, long endTime, RLESparseResourceAllocation planLoads, RLESparseResourceAllocation planModifications, org.apache.hadoop.yarn.api.records.Resource capacity, org.apache.hadoop.yarn.util.resource.ResourceCalculator resCalc, long step) throws PlanningException - Throws:
PlanningException
-
getDurationIntervalGangsCanFit
protected static int getDurationIntervalGangsCanFit(long startTime, long endTime, RLESparseResourceAllocation planModifications, org.apache.hadoop.yarn.api.records.Resource capacity, RLESparseResourceAllocation netRLERes, org.apache.hadoop.yarn.util.resource.ResourceCalculator resCalc, org.apache.hadoop.yarn.api.records.Resource requestedResources) throws PlanningException - Throws:
PlanningException
-
calcCostOfInterval
protected double calcCostOfInterval(long startTime, long endTime, RLESparseResourceAllocation planLoads, RLESparseResourceAllocation planModifications, org.apache.hadoop.yarn.api.records.Resource capacity, org.apache.hadoop.yarn.util.resource.ResourceCalculator resCalc, long step) -
calcCostOfTimeSlot
protected double calcCostOfTimeSlot(long t, RLESparseResourceAllocation planLoads, RLESparseResourceAllocation planModifications, org.apache.hadoop.yarn.api.records.Resource capacity, org.apache.hadoop.yarn.util.resource.ResourceCalculator resCalc) -
getLoadAtTime
protected org.apache.hadoop.yarn.api.records.Resource getLoadAtTime(long t, RLESparseResourceAllocation planLoads, RLESparseResourceAllocation planModifications) -
calcCostOfLoad
protected static double calcCostOfLoad(org.apache.hadoop.yarn.api.records.Resource load, org.apache.hadoop.yarn.api.records.Resource capacity, org.apache.hadoop.yarn.util.resource.ResourceCalculator resCalc) -
stepRoundDown
protected static long stepRoundDown(long t, long step) -
stepRoundUp
protected static long stepRoundUp(long t, long step)
-