public class RLESparseResourceAllocation extends Object
Modifier and Type | Class and Description |
---|---|
static class |
RLESparseResourceAllocation.RLEOperator
The set of operators that can be applied to two
RLESparseResourceAllocation during a merge operation. |
Modifier and Type | Field and Description |
---|---|
protected NavigableMap<Long,org.apache.hadoop.yarn.api.records.Resource> |
cumulativeCapacity |
protected Lock |
readLock |
Constructor and Description |
---|
RLESparseResourceAllocation(NavigableMap<Long,org.apache.hadoop.yarn.api.records.Resource> out,
org.apache.hadoop.yarn.util.resource.ResourceCalculator resourceCalculator) |
RLESparseResourceAllocation(org.apache.hadoop.yarn.util.resource.ResourceCalculator resourceCalculator) |
Modifier and Type | Method and Description |
---|---|
boolean |
addInterval(ReservationInterval reservationInterval,
org.apache.hadoop.yarn.api.records.Resource totCap)
Add a resource for the specified interval.
|
org.apache.hadoop.yarn.api.records.Resource |
getCapacityAtTime(long tick)
Returns the capacity, i.e.
|
NavigableMap<Long,org.apache.hadoop.yarn.api.records.Resource> |
getCumulative() |
long |
getEarliestStartTime()
Get the timestamp of the earliest resource allocation.
|
long |
getLatestNonNullTime()
Get the timestamp of the latest non-null resource allocation.
|
org.apache.hadoop.yarn.api.records.Resource |
getMaximumPeriodicCapacity(long tick,
long period)
Get the maximum capacity across specified time instances.
|
org.apache.hadoop.yarn.api.records.Resource |
getMinimumCapacityInInterval(ReservationInterval interval)
Get the minimum capacity in the specified time range.
|
RLESparseResourceAllocation |
getRangeOverlapping(long start,
long end)
Get a
RLESparseResourceAllocation view of the Resource
allocations between the specified start and end times. |
org.apache.hadoop.yarn.util.resource.ResourceCalculator |
getResourceCalculator() |
boolean |
isEmpty()
Returns true if there are no non-zero entries.
|
static RLESparseResourceAllocation |
merge(org.apache.hadoop.yarn.util.resource.ResourceCalculator resCalc,
org.apache.hadoop.yarn.api.records.Resource clusterResource,
RLESparseResourceAllocation a,
RLESparseResourceAllocation b,
RLESparseResourceAllocation.RLEOperator operator,
long start,
long end)
Merges the range start to end of two
RLESparseResourceAllocation
using a given RLEOperator . |
boolean |
removeInterval(ReservationInterval reservationInterval,
org.apache.hadoop.yarn.api.records.Resource totCap)
Removes a resource for the specified interval.
|
void |
shift(long delta)
This method shifts all the timestamp of the
Resource entries by the
specified "delta". |
Map<ReservationInterval,org.apache.hadoop.yarn.api.records.Resource> |
toIntervalMap()
Returns the representation of the current resources allocated over time as
an interval map (in the defined non-null range).
|
String |
toString() |
protected NavigableMap<Long,org.apache.hadoop.yarn.api.records.Resource> cumulativeCapacity
protected final Lock readLock
public RLESparseResourceAllocation(org.apache.hadoop.yarn.util.resource.ResourceCalculator resourceCalculator)
public RLESparseResourceAllocation(NavigableMap<Long,org.apache.hadoop.yarn.api.records.Resource> out, org.apache.hadoop.yarn.util.resource.ResourceCalculator resourceCalculator)
public boolean addInterval(ReservationInterval reservationInterval, org.apache.hadoop.yarn.api.records.Resource totCap)
reservationInterval
- the interval for which the resource is to be
addedtotCap
- the resource to be addedpublic boolean removeInterval(ReservationInterval reservationInterval, org.apache.hadoop.yarn.api.records.Resource totCap)
reservationInterval
- the interval for which the resource is to be
removedtotCap
- the resource to be removedpublic org.apache.hadoop.yarn.api.records.Resource getCapacityAtTime(long tick)
tick
- timeStap at which resource needs to be knownpublic long getEarliestStartTime()
public long getLatestNonNullTime()
public boolean isEmpty()
public Map<ReservationInterval,org.apache.hadoop.yarn.api.records.Resource> toIntervalMap()
public NavigableMap<Long,org.apache.hadoop.yarn.api.records.Resource> getCumulative()
public org.apache.hadoop.yarn.util.resource.ResourceCalculator getResourceCalculator()
public static RLESparseResourceAllocation merge(org.apache.hadoop.yarn.util.resource.ResourceCalculator resCalc, org.apache.hadoop.yarn.api.records.Resource clusterResource, RLESparseResourceAllocation a, RLESparseResourceAllocation b, RLESparseResourceAllocation.RLEOperator operator, long start, long end) throws PlanningException
RLESparseResourceAllocation
using a given RLEOperator
.resCalc
- the resource calculatorclusterResource
- the total cluster resources (for DRF)a
- the left operandb
- the right operandoperator
- the operator to be applied during mergestart
- the start-time of the range to be consideredend
- the end-time of the range to be consideredPlanningException
- in case the operator is subtractTestPositive and
the result would contain a negative valuepublic RLESparseResourceAllocation getRangeOverlapping(long start, long end)
RLESparseResourceAllocation
view of the Resource
allocations between the specified start and end times.start
- the time from which the Resource
allocations are
requiredend
- the time upto which the Resource
allocations are
requiredpublic void shift(long delta)
Resource
entries by the
specified "delta".delta
- the time by which to shift the Resource
allocationspublic org.apache.hadoop.yarn.api.records.Resource getMaximumPeriodicCapacity(long tick, long period)
tick
- the starting time instanceperiod
- interval at which capacity is evaluatedpublic org.apache.hadoop.yarn.api.records.Resource getMinimumCapacityInInterval(ReservationInterval interval)
interval
- the ReservationInterval
to be searchedCopyright © 2008–2023 Apache Software Foundation. All rights reserved.