org.apache.hadoop.yarn.server.resourcemanager.reservation
Class RLESparseResourceAllocation

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

public class RLESparseResourceAllocation
extends Object

This is a run length encoded sparse data structure that maintains resource allocations over time


Constructor Summary
RLESparseResourceAllocation(org.apache.hadoop.yarn.util.resource.ResourceCalculator resourceCalculator, org.apache.hadoop.yarn.api.records.Resource minAlloc)
           
 
Method Summary
 boolean addCompositeInterval(ReservationInterval reservationInterval, List<org.apache.hadoop.yarn.api.records.ReservationRequest> ReservationRequests, org.apache.hadoop.yarn.api.records.Resource clusterResource)
          Add multiple resources for the specified interval
 boolean addInterval(ReservationInterval reservationInterval, org.apache.hadoop.yarn.api.records.ReservationRequest capacity)
          Add a resource for the specified interval
 org.apache.hadoop.yarn.api.records.Resource getCapacityAtTime(long tick)
          Returns the capacity, i.e.
 long getEarliestStartTime()
          Get the timestamp of the earliest resource allocation
 long getLatestEndTime()
          Get the timestamp of the latest resource allocation
 boolean isEmpty()
          Returns true if there are no non-zero entries
 boolean removeInterval(ReservationInterval reservationInterval, org.apache.hadoop.yarn.api.records.ReservationRequest capacity)
          Removes a resource for the specified interval
 String toMemJSONString()
          Returns the JSON string representation of the current resources allocated over time
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

RLESparseResourceAllocation

public RLESparseResourceAllocation(org.apache.hadoop.yarn.util.resource.ResourceCalculator resourceCalculator,
                                   org.apache.hadoop.yarn.api.records.Resource minAlloc)
Method Detail

addInterval

public boolean addInterval(ReservationInterval reservationInterval,
                           org.apache.hadoop.yarn.api.records.ReservationRequest capacity)
Add a resource for the specified interval

Parameters:
reservationInterval - the interval for which the resource is to be added
capacity - the resource to be added
Returns:
true if addition is successful, false otherwise

addCompositeInterval

public boolean addCompositeInterval(ReservationInterval reservationInterval,
                                    List<org.apache.hadoop.yarn.api.records.ReservationRequest> ReservationRequests,
                                    org.apache.hadoop.yarn.api.records.Resource clusterResource)
Add multiple resources for the specified interval

Parameters:
reservationInterval - the interval for which the resource is to be added
ReservationRequests - the resources to be added
clusterResource - the total resources in the cluster
Returns:
true if addition is successful, false otherwise

removeInterval

public boolean removeInterval(ReservationInterval reservationInterval,
                              org.apache.hadoop.yarn.api.records.ReservationRequest capacity)
Removes a resource for the specified interval

Parameters:
reservationInterval - the interval for which the resource is to be removed
capacity - the resource to be removed
Returns:
true if removal is successful, false otherwise

getCapacityAtTime

public org.apache.hadoop.yarn.api.records.Resource getCapacityAtTime(long tick)
Returns the capacity, i.e. total resources allocated at the specified point of time

Parameters:
tick - the time (UTC in ms) at which the capacity is requested
Returns:
the resources allocated at the specified time

getEarliestStartTime

public long getEarliestStartTime()
Get the timestamp of the earliest resource allocation

Returns:
the timestamp of the first resource allocation

getLatestEndTime

public long getLatestEndTime()
Get the timestamp of the latest resource allocation

Returns:
the timestamp of the last resource allocation

isEmpty

public boolean isEmpty()
Returns true if there are no non-zero entries

Returns:
true if there are no allocations or false otherwise

toString

public String toString()
Overrides:
toString in class Object

toMemJSONString

public String toMemJSONString()
Returns the JSON string representation of the current resources allocated over time

Returns:
the JSON string representation of the current resources allocated over time


Copyright © 2014 Apache Software Foundation. All Rights Reserved.