Class PeriodicRLESparseResourceAllocation
java.lang.Object
org.apache.hadoop.yarn.server.resourcemanager.reservation.RLESparseResourceAllocation
org.apache.hadoop.yarn.server.resourcemanager.reservation.PeriodicRLESparseResourceAllocation
This data structure stores a periodic
RLESparseResourceAllocation.
Default period is 1 day (86400000ms).-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.hadoop.yarn.server.resourcemanager.reservation.RLESparseResourceAllocation
RLESparseResourceAllocation.RLEOperator -
Field Summary
Fields inherited from class org.apache.hadoop.yarn.server.resourcemanager.reservation.RLESparseResourceAllocation
cumulativeCapacity, readLock -
Constructor Summary
ConstructorsConstructorDescriptionPeriodicRLESparseResourceAllocation(RLESparseResourceAllocation rleVector, Long timePeriod) Constructor.PeriodicRLESparseResourceAllocation(org.apache.hadoop.yarn.util.resource.ResourceCalculator resourceCalculator) Constructor.PeriodicRLESparseResourceAllocation(org.apache.hadoop.yarn.util.resource.ResourceCalculator resourceCalculator, Long timePeriod) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionbooleanaddInterval(ReservationInterval interval, org.apache.hadoop.yarn.api.records.Resource resource) Add resource for the specified interval.org.apache.hadoop.yarn.api.records.ResourcegetCapacityAtTime(long tick) Get capacity at time based on periodic repetition.org.apache.hadoop.yarn.api.records.ResourcegetMaximumPeriodicCapacity(long tick, long period) Get maximum capacity at periodic offsets from the specified time.getRangeOverlapping(long start, long end) Get aRLESparseResourceAllocationview of theResourceallocations between the specified start and end times.longGet time period of PeriodicRLESparseResourceAllocation.booleanremoveInterval(ReservationInterval interval, org.apache.hadoop.yarn.api.records.Resource resource) Removes a resource for the specified interval.toString()Methods inherited from class org.apache.hadoop.yarn.server.resourcemanager.reservation.RLESparseResourceAllocation
getCumulative, getEarliestStartTime, getLatestNonNullTime, getMinimumCapacityInInterval, getResourceCalculator, isEmpty, merge, shift, toIntervalMap
-
Constructor Details
-
PeriodicRLESparseResourceAllocation
public PeriodicRLESparseResourceAllocation(org.apache.hadoop.yarn.util.resource.ResourceCalculator resourceCalculator, Long timePeriod) Constructor.- Parameters:
resourceCalculator-ResourceCalculatorthe 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-ResourceCalculatorthe resource calculator to use..
-
PeriodicRLESparseResourceAllocation
@VisibleForTesting public PeriodicRLESparseResourceAllocation(RLESparseResourceAllocation rleVector, Long timePeriod) Constructor.- Parameters:
rleVector-RLESparseResourceAllocationwith 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:
getCapacityAtTimein classRLESparseResourceAllocation- Parameters:
tick- UTC time for which the allocatedResourceis queried.- Returns:
Resourceallocated 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 byInMemoryPlanwhile placing reservations between 0 and timePeriod. The interval may include 0, but the end time must be strictly less than timePeriod.- Overrides:
addIntervalin classRLESparseResourceAllocation- Parameters:
interval-ReservationIntervalto which the specified resource is to be added.resource-Resourceto 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:
removeIntervalin classRLESparseResourceAllocation- Parameters:
interval- theReservationIntervalfor which the resource is to be removed.resource- theResourceto 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:
getMaximumPeriodicCapacityin classRLESparseResourceAllocation- 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
Resourceacross the specified time instants.
-
getTimePeriod
public long getTimePeriod()Get time period of PeriodicRLESparseResourceAllocation.- Returns:
- timePeriod time period represented in ms.
-
toString
- Overrides:
toStringin classRLESparseResourceAllocation
-
getRangeOverlapping
Description copied from class:RLESparseResourceAllocationGet aRLESparseResourceAllocationview of theResourceallocations between the specified start and end times.- Overrides:
getRangeOverlappingin classRLESparseResourceAllocation- Parameters:
start- the time from which theResourceallocations are requiredend- the time upto which theResourceallocations are required- Returns:
- the overlapping allocations
-