Class InMemoryReservationAllocation

java.lang.Object
org.apache.hadoop.yarn.server.resourcemanager.reservation.InMemoryReservationAllocation
All Implemented Interfaces:
Comparable<ReservationAllocation>, ReservationAllocation

public class InMemoryReservationAllocation extends Object implements ReservationAllocation
An in memory implementation of a reservation allocation using the RLESparseResourceAllocation
  • Constructor Summary

    Constructors
    Constructor
    Description
    InMemoryReservationAllocation(org.apache.hadoop.yarn.api.records.ReservationId reservationID, org.apache.hadoop.yarn.api.records.ReservationDefinition contract, String user, String planName, long startTime, long endTime, Map<ReservationInterval,org.apache.hadoop.yarn.api.records.Resource> allocations, org.apache.hadoop.yarn.util.resource.ResourceCalculator calculator, org.apache.hadoop.yarn.api.records.Resource minAlloc)
     
    InMemoryReservationAllocation(org.apache.hadoop.yarn.api.records.ReservationId reservationID, org.apache.hadoop.yarn.api.records.ReservationDefinition contract, String user, String planName, long startTime, long endTime, Map<ReservationInterval,org.apache.hadoop.yarn.api.records.Resource> allocations, org.apache.hadoop.yarn.util.resource.ResourceCalculator calculator, org.apache.hadoop.yarn.api.records.Resource minAlloc, boolean hasGang)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    int
     
    boolean
    Returns whether the reservation has gang semantics or not
    boolean
     
    long
    Returns the time at which the reservation was accepted by the system
    Map<ReservationInterval,org.apache.hadoop.yarn.api.records.Resource>
    Returns the map of resources requested against the time interval for which they were.
    long
    Returns the time at which the reservation terminates.
    long
    Get the periodicity of this reservation representing the time period of the periodic job.
    Return a string identifying the plan to which the reservation belongs
    org.apache.hadoop.yarn.api.records.ReservationDefinition
    Returns the original ReservationDefinition submitted by the client
    org.apache.hadoop.yarn.api.records.ReservationId
    Returns the unique identifier ReservationId that represents the reservation
    org.apache.hadoop.yarn.api.records.Resource
    getResourcesAtTime(long tick)
    Returns the capacity represented by cumulative resources reserved by the reservation at the specified point of time
    Return a RLE representation of used resources.
    getResourcesOverTime(long start, long end)
    Return a RLE representation of used resources.
    long
    Returns the time at which the reservation is activated.
    Returns the user who requested the reservation
    int
     
    void
    setAcceptanceTimestamp(long acceptedAt)
    Sets the time at which the reservation was accepted by the system
    void
    setPeriodicity(long period)
    Set the periodicity of this reservation representing the time period of the periodic job.
     

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • InMemoryReservationAllocation

      public InMemoryReservationAllocation(org.apache.hadoop.yarn.api.records.ReservationId reservationID, org.apache.hadoop.yarn.api.records.ReservationDefinition contract, String user, String planName, long startTime, long endTime, Map<ReservationInterval,org.apache.hadoop.yarn.api.records.Resource> allocations, org.apache.hadoop.yarn.util.resource.ResourceCalculator calculator, org.apache.hadoop.yarn.api.records.Resource minAlloc)
    • InMemoryReservationAllocation

      public InMemoryReservationAllocation(org.apache.hadoop.yarn.api.records.ReservationId reservationID, org.apache.hadoop.yarn.api.records.ReservationDefinition contract, String user, String planName, long startTime, long endTime, Map<ReservationInterval,org.apache.hadoop.yarn.api.records.Resource> allocations, org.apache.hadoop.yarn.util.resource.ResourceCalculator calculator, org.apache.hadoop.yarn.api.records.Resource minAlloc, boolean hasGang)
  • Method Details

    • getReservationId

      public org.apache.hadoop.yarn.api.records.ReservationId getReservationId()
      Description copied from interface: ReservationAllocation
      Returns the unique identifier ReservationId that represents the reservation
      Specified by:
      getReservationId in interface ReservationAllocation
      Returns:
      reservationId the unique identifier ReservationId that represents the reservation
    • getReservationDefinition

      public org.apache.hadoop.yarn.api.records.ReservationDefinition getReservationDefinition()
      Description copied from interface: ReservationAllocation
      Returns the original ReservationDefinition submitted by the client
      Specified by:
      getReservationDefinition in interface ReservationAllocation
      Returns:
      the ReservationDefinition submitted by the client
    • getStartTime

      public long getStartTime()
      Description copied from interface: ReservationAllocation
      Returns the time at which the reservation is activated.
      Specified by:
      getStartTime in interface ReservationAllocation
      Returns:
      the time at which the reservation is activated
    • getEndTime

      public long getEndTime()
      Description copied from interface: ReservationAllocation
      Returns the time at which the reservation terminates.
      Specified by:
      getEndTime in interface ReservationAllocation
      Returns:
      the time at which the reservation terminates
    • getAllocationRequests

      public Map<ReservationInterval,org.apache.hadoop.yarn.api.records.Resource> getAllocationRequests()
      Description copied from interface: ReservationAllocation
      Returns the map of resources requested against the time interval for which they were.
      Specified by:
      getAllocationRequests in interface ReservationAllocation
      Returns:
      the allocationRequests the map of resources requested against the time interval for which they were
    • getPlanName

      public String getPlanName()
      Description copied from interface: ReservationAllocation
      Return a string identifying the plan to which the reservation belongs
      Specified by:
      getPlanName in interface ReservationAllocation
      Returns:
      the plan to which the reservation belongs
    • getUser

      public String getUser()
      Description copied from interface: ReservationAllocation
      Returns the user who requested the reservation
      Specified by:
      getUser in interface ReservationAllocation
      Returns:
      the user who requested the reservation
    • containsGangs

      public boolean containsGangs()
      Description copied from interface: ReservationAllocation
      Returns whether the reservation has gang semantics or not
      Specified by:
      containsGangs in interface ReservationAllocation
      Returns:
      true if there is a gang request, false otherwise
    • setAcceptanceTimestamp

      public void setAcceptanceTimestamp(long acceptedAt)
      Description copied from interface: ReservationAllocation
      Sets the time at which the reservation was accepted by the system
      Specified by:
      setAcceptanceTimestamp in interface ReservationAllocation
      Parameters:
      acceptedAt - the time at which the reservation was accepted by the system
    • getAcceptanceTime

      public long getAcceptanceTime()
      Description copied from interface: ReservationAllocation
      Returns the time at which the reservation was accepted by the system
      Specified by:
      getAcceptanceTime in interface ReservationAllocation
      Returns:
      the time at which the reservation was accepted by the system
    • getResourcesAtTime

      public org.apache.hadoop.yarn.api.records.Resource getResourcesAtTime(long tick)
      Description copied from interface: ReservationAllocation
      Returns the capacity represented by cumulative resources reserved by the reservation at the specified point of time
      Specified by:
      getResourcesAtTime in interface ReservationAllocation
      Parameters:
      tick - the time (UTC in ms) for which the reserved resources are requested
      Returns:
      the resources reserved at the specified time
    • getResourcesOverTime

      public RLESparseResourceAllocation getResourcesOverTime()
      Description copied from interface: ReservationAllocation
      Return a RLE representation of used resources.
      Specified by:
      getResourcesOverTime in interface ReservationAllocation
      Returns:
      a RLE encoding of resources allocated over time.
    • getResourcesOverTime

      public RLESparseResourceAllocation getResourcesOverTime(long start, long end)
      Description copied from interface: ReservationAllocation
      Return a RLE representation of used resources.
      Specified by:
      getResourcesOverTime in interface ReservationAllocation
      Parameters:
      start - start of the time interval.
      end - end of the time interval.
      Returns:
      a RLE encoding of resources allocated over time.
    • getPeriodicity

      public long getPeriodicity()
      Description copied from interface: ReservationAllocation
      Get the periodicity of this reservation representing the time period of the periodic job. Period is represented in milliseconds for periodic jobs. Period is 0 for non-periodic jobs.
      Specified by:
      getPeriodicity in interface ReservationAllocation
      Returns:
      periodicity of this reservation
    • setPeriodicity

      public void setPeriodicity(long period)
      Description copied from interface: ReservationAllocation
      Set the periodicity of this reservation representing the time period of the periodic job. Period is represented in milliseconds for periodic jobs. Period is 0 for non-periodic jobs.
      Specified by:
      setPeriodicity in interface ReservationAllocation
      Parameters:
      period - periodicity of this reservation
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • compareTo

      public int compareTo(ReservationAllocation other)
      Specified by:
      compareTo in interface Comparable<ReservationAllocation>
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object