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. |
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.
|
RLESparseResourceAllocation |
getRangeOverlapping(long start,
long end) |
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.
|
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 |
toMemJSONString()
Returns the JSON string representation of the current resources allocated
over time.
|
String |
toString() |
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)
public long getEarliestStartTime()
public long getLatestNonNullTime()
public boolean isEmpty()
public String toMemJSONString()
public Map<ReservationInterval,org.apache.hadoop.yarn.api.records.Resource> toIntervalMap()
public NavigableMap<Long,org.apache.hadoop.yarn.api.records.Resource> getCumulative()
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)
Copyright © 2017 Apache Software Foundation. All Rights Reserved.