Class StageAllocatorLowCostAligned

java.lang.Object
org.apache.hadoop.yarn.server.resourcemanager.reservation.planning.StageAllocatorLowCostAligned
All Implemented Interfaces:
StageAllocator

public class StageAllocatorLowCostAligned extends Object implements 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.
  • 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: StageAllocator
      Computes the allocation of a stage inside a defined time interval.
      Specified by:
      computeStageAllocation in interface StageAllocator
      Parameters:
      plan - the Plan to which the reservation must be fitted
      planLoads - a 'dirty' read of the plan loads at each time
      planModifications - the allocations performed by the planning algorithm which are not yet reflected by plan
      rr - the stage
      stageArrival - the arrival time (earliest starting time) set for the stage by the two phase planning algorithm
      stageDeadline - the deadline of the stage set by the two phase planning algorithm
      period - the periodicity with which this stage appears
      user - name of the user
      oldId - 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)