All Superinterfaces:
PlanContext
All Known Subinterfaces:
Plan
All Known Implementing Classes:
InMemoryPlan

public interface PlanEdit extends PlanContext
This interface groups the methods used to modify the state of a Plan.
  • Method Details

    • addReservation

      boolean addReservation(ReservationAllocation reservation, boolean isRecovering) throws PlanningException
      Add a new ReservationAllocation to the plan.
      Parameters:
      reservation - the ReservationAllocation to be added to the plan
      isRecovering - flag to indicate if reservation is being added as part of failover or not
      Returns:
      true if addition is successful, false otherwise
      Throws:
      PlanningException - if addition is unsuccessful
    • updateReservation

      boolean updateReservation(ReservationAllocation reservation) throws PlanningException
      Updates an existing ReservationAllocation in the plan. This is required for re-negotiation.
      Parameters:
      reservation - the ReservationAllocation to be updated the plan
      Returns:
      true if update is successful, false otherwise
      Throws:
      PlanningException - if update is unsuccessful
    • deleteReservation

      boolean deleteReservation(org.apache.hadoop.yarn.api.records.ReservationId reservationID) throws PlanningException
      Delete an existing ReservationAllocation from the plan identified uniquely by its ReservationId. This will generally be used for garbage collection.
      Parameters:
      reservationID - the ReservationAllocation to be deleted from the plan identified uniquely by its ReservationId
      Returns:
      true if delete is successful, false otherwise
      Throws:
      PlanningException - if deletion is unsuccessful
    • archiveCompletedReservations

      void archiveCompletedReservations(long tick) throws PlanningException
      Method invoked to garbage collect old reservations. It cleans up expired reservations that have fallen out of the sliding archival window.
      Parameters:
      tick - the current time from which the archival window is computed
      Throws:
      PlanningException - if archival is unsuccessful
    • setTotalCapacity

      void setTotalCapacity(org.apache.hadoop.yarn.api.records.Resource capacity)
      Sets the overall capacity in terms of Resource assigned to this plan.
      Parameters:
      capacity - the overall capacity in terms of Resource assigned to this plan
    • 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