Class PeriodicRLESparseResourceAllocation

java.lang.Object
org.apache.hadoop.yarn.server.resourcemanager.reservation.RLESparseResourceAllocation
org.apache.hadoop.yarn.server.resourcemanager.reservation.PeriodicRLESparseResourceAllocation

public class PeriodicRLESparseResourceAllocation extends RLESparseResourceAllocation
This data structure stores a periodic RLESparseResourceAllocation. Default period is 1 day (86400000ms).
  • Constructor Details

    • PeriodicRLESparseResourceAllocation

      public PeriodicRLESparseResourceAllocation(org.apache.hadoop.yarn.util.resource.ResourceCalculator resourceCalculator, Long timePeriod)
      Constructor.
      Parameters:
      resourceCalculator - ResourceCalculator the resource calculator to use.
      timePeriod - Time period in milliseconds.
    • PeriodicRLESparseResourceAllocation

      public PeriodicRLESparseResourceAllocation(org.apache.hadoop.yarn.util.resource.ResourceCalculator resourceCalculator)
      Constructor. Default time period set to 1 day.
      Parameters:
      resourceCalculator - ResourceCalculator the resource calculator to use..
    • PeriodicRLESparseResourceAllocation

      @VisibleForTesting public PeriodicRLESparseResourceAllocation(RLESparseResourceAllocation rleVector, Long timePeriod)
      Constructor.
      Parameters:
      rleVector - RLESparseResourceAllocation with the run-length encoded data.
      timePeriod - Time period in milliseconds.
  • Method Details

    • getCapacityAtTime

      public org.apache.hadoop.yarn.api.records.Resource getCapacityAtTime(long tick)
      Get capacity at time based on periodic repetition.
      Overrides:
      getCapacityAtTime in class RLESparseResourceAllocation
      Parameters:
      tick - UTC time for which the allocated Resource is queried.
      Returns:
      Resource allocated at specified time
    • addInterval

      public boolean addInterval(ReservationInterval interval, org.apache.hadoop.yarn.api.records.Resource resource)
      Add resource for the specified interval. This function will be used by InMemoryPlan while placing reservations between 0 and timePeriod. The interval may include 0, but the end time must be strictly less than timePeriod.
      Overrides:
      addInterval in class RLESparseResourceAllocation
      Parameters:
      interval - ReservationInterval to which the specified resource is to be added.
      resource - Resource to be added to the interval specified.
      Returns:
      true if addition is successful, false otherwise
    • removeInterval

      public boolean removeInterval(ReservationInterval interval, org.apache.hadoop.yarn.api.records.Resource resource)
      Removes a resource for the specified interval.
      Overrides:
      removeInterval in class RLESparseResourceAllocation
      Parameters:
      interval - the ReservationInterval for which the resource is to be removed.
      resource - the Resource to be removed.
      Returns:
      true if removal is successful, false otherwise
    • getMaximumPeriodicCapacity

      public org.apache.hadoop.yarn.api.records.Resource getMaximumPeriodicCapacity(long tick, long period)
      Get maximum capacity at periodic offsets from the specified time.
      Overrides:
      getMaximumPeriodicCapacity in class RLESparseResourceAllocation
      Parameters:
      tick - UTC time base from which offsets are specified for finding the maximum capacity.
      period - periodic offset at which capacities are evaluated.
      Returns:
      the maximum Resource across the specified time instants.
    • getTimePeriod

      public long getTimePeriod()
      Get time period of PeriodicRLESparseResourceAllocation.
      Returns:
      timePeriod time period represented in ms.
    • toString

      public String toString()
      Overrides:
      toString in class RLESparseResourceAllocation
    • getRangeOverlapping

      public RLESparseResourceAllocation getRangeOverlapping(long start, long end)
      Description copied from class: RLESparseResourceAllocation
      Get a RLESparseResourceAllocation view of the Resource allocations between the specified start and end times.
      Overrides:
      getRangeOverlapping in class RLESparseResourceAllocation
      Parameters:
      start - the time from which the Resource allocations are required
      end - the time upto which the Resource allocations are required
      Returns:
      the overlapping allocations