All Superinterfaces:
PlanContext, PlanEdit
All Known Implementing Classes:
InMemoryPlan

public interface Plan extends PlanContext, PlanEdit
A Plan represents the central data structure of a reservation system that maintains the "agenda" for the cluster. In particular, it maintains information on how a set of ReservationDefinition that have been previously accepted will be honored. ReservationDefinition submitted by the users through the RM public APIs are passed to appropriate ReservationAgents, which in turn will consult the Plan (via the PlanView interface) and try to determine whether there are sufficient resources available in this Plan to satisfy the temporal and resource constraints of a ReservationDefinition. If a valid allocation is found the agent will try to store it in the plan (via the PlanEdit interface). Upon success the system return to the user a positive acknowledgment, and a reservation identifier to be later used to access the reserved resources. A PlanFollower will continuously read from the Plan and will affect the instantaneous allocation of resources among jobs running by publishing the "current" slice of the Plan to the underlying scheduler. I.e., the configuration of queues/weights of the scheduler are modified to reflect the allocations in the Plan. As this interface have several methods we decompose them into three groups: PlanContext: containing configuration type information, PlanView read-only access to the plan state, and PlanEdit write access to the plan state.
  • Method Details

    • getReservations

      Set<ReservationAllocation> getReservations(org.apache.hadoop.yarn.api.records.ReservationId reservationID, ReservationInterval interval, String user)
      Return a set of ReservationAllocation identified by the user who made the reservation.
      Parameters:
      reservationID - the unqiue id to identify the ReservationAllocation
      interval - the time interval used to retrieve the reservation allocations from. Only reservations with start time no greater than the interval end time, and end time no less than the interval start time will be selected.
      user - the user to retrieve the reservation allocation from.
      Returns:
      a set of ReservationAllocation identified by the user who made the reservation
    • getReservations

      Set<ReservationAllocation> getReservations(org.apache.hadoop.yarn.api.records.ReservationId reservationID, ReservationInterval interval)
      Return a set of ReservationAllocation identified by any user.
      Parameters:
      reservationID - the unqiue id to identify the ReservationAllocation
      interval - the time interval used to retrieve the reservation allocations from. Only reservations with start time no greater than the interval end time, and end time no less than the interval start time will be selected.
      Returns:
      a set of ReservationAllocation identified by any user
    • getReservationById

      ReservationAllocation getReservationById(org.apache.hadoop.yarn.api.records.ReservationId reservationID)
      Return a ReservationAllocation identified by its ReservationId
      Parameters:
      reservationID - the unique id to identify the ReservationAllocation
      Returns:
      ReservationAllocation identified by the specified id
    • getReservationByUserAtTime

      Set<ReservationAllocation> getReservationByUserAtTime(String user, long t)
      Return a set of ReservationAllocation that belongs to a certain user and overlaps time t.
      Parameters:
      user - the user being considered
      t - the instant in time being considered
      Returns:
      set of active ReservationAllocations for this user at this time
    • getReservationsAtTime

      Set<ReservationAllocation> getReservationsAtTime(long tick)
      Gets all the active reservations at the specified point of time
      Parameters:
      tick - the time (UTC in ms) for which the active reservations are requested
      Returns:
      set of active reservations at the specified time
    • getAllReservations

      Set<ReservationAllocation> getAllReservations()
      Gets all the reservations in the plan
      Returns:
      set of all reservations handled by this Plan
    • getTotalCommittedResources

      org.apache.hadoop.yarn.api.records.Resource getTotalCommittedResources(long tick)
      Returns the total Resource reserved for all users at the specified time
      Parameters:
      tick - the time (UTC in ms) for which the reserved resources are requested
      Returns:
      the total Resource reserved for all users at the specified time
    • getTotalCapacity

      org.apache.hadoop.yarn.api.records.Resource getTotalCapacity()
      Returns the overall capacity in terms of Resource assigned to this plan (typically will correspond to the absolute capacity of the corresponding queue).
      Returns:
      the overall capacity in terms of Resource assigned to this plan
    • getEarliestStartTime

      long getEarliestStartTime()
      Gets the time (UTC in ms) at which the first reservation starts
      Returns:
      the time (UTC in ms) at which the first reservation starts
    • getLastEndTime

      long getLastEndTime()
      Returns the time (UTC in ms) at which the last reservation terminates
      Returns:
      the time (UTC in ms) at which the last reservation terminates
    • getAvailableResourceOverTime

      RLESparseResourceAllocation getAvailableResourceOverTime(String user, org.apache.hadoop.yarn.api.records.ReservationId oldId, long start, long end, long period) throws PlanningException
      This method returns the amount of resources available to a given user (optionally if removing a certain reservation) over the start-end time range. If the request is periodic (period is non-zero) we return the minimum amount of resources available to periodic reservations (in all "period" windows within the system maxPeriod / LCM).
      Parameters:
      user - the user being considered
      oldId - the identifier of the existing reservation
      start - start of the time interval.
      end - end of the time interval.
      period - the ms periodicty for this request (loop and pick min till maxPeriodicity)
      Returns:
      a view of the plan as it is available to this user
      Throws:
      PlanningException - if operation is unsuccessful
    • getReservationCountForUserOverTime

      RLESparseResourceAllocation getReservationCountForUserOverTime(String user, long start, long end)
      This method returns a RLE encoded view of the user reservation count utilization between start and end time.
      Parameters:
      user - the user being considered
      start - start of the time interval.
      end - end of the time interval.
      Returns:
      RLE encoded view of reservation used over time
    • getConsumptionForUserOverTime

      RLESparseResourceAllocation getConsumptionForUserOverTime(String user, long start, long end)
      This method returns a RLE encoded view of the user reservation utilization between start and end time.
      Parameters:
      user - the user being considered
      start - start of the time interval.
      end - end of the time interval.
      Returns:
      RLE encoded view of resources used over time
    • getCumulativeLoadOverTime

      RLESparseResourceAllocation getCumulativeLoadOverTime(long start, long end) throws PlanningException
      Get the cumulative load over a time interval.
      Parameters:
      start - start of the time interval.
      end - end of the time interval.
      Returns:
      RLE sparse allocation.
      Throws:
      PlanningException - if operation is unsuccessful