Interface Plan
- All Superinterfaces:
PlanContext,PlanEdit
- All Known Implementing Classes:
InMemoryPlan
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 Summary
Modifier and TypeMethodDescriptionGets all the reservations in the plangetAvailableResourceOverTime(String user, org.apache.hadoop.yarn.api.records.ReservationId oldId, long start, long end, long period) This method returns the amount of resources available to a given user (optionally if removing a certain reservation) over the start-end time range.getConsumptionForUserOverTime(String user, long start, long end) This method returns a RLE encoded view of the user reservation utilization between start and end time.getCumulativeLoadOverTime(long start, long end) Get the cumulative load over a time interval.longGets the time (UTC in ms) at which the first reservation startslongReturns the time (UTC in ms) at which the last reservation terminatesgetReservationById(org.apache.hadoop.yarn.api.records.ReservationId reservationID) Return aReservationAllocationidentified by itsReservationIdgetReservationByUserAtTime(String user, long t) Return a set ofReservationAllocationthat belongs to a certain user and overlaps time t.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.getReservations(org.apache.hadoop.yarn.api.records.ReservationId reservationID, ReservationInterval interval) Return a set ofReservationAllocationidentified by any user.getReservations(org.apache.hadoop.yarn.api.records.ReservationId reservationID, ReservationInterval interval, String user) Return a set ofReservationAllocationidentified by the user who made the reservation.getReservationsAtTime(long tick) Gets all the active reservations at the specified point of timeorg.apache.hadoop.yarn.api.records.ResourceReturns the overall capacity in terms ofResourceassigned to this plan (typically will correspond to the absolute capacity of the corresponding queue).org.apache.hadoop.yarn.api.records.ResourcegetTotalCommittedResources(long tick) Returns the totalResourcereserved for all users at the specified timeMethods inherited from interface org.apache.hadoop.yarn.server.resourcemanager.reservation.PlanContext
getMaximumAllocation, getMaximumPeriodicity, getMinimumAllocation, getMoveOnExpiry, getQueueMetrics, getQueueName, getReplanner, getReservationAgent, getResourceCalculator, getSharingPolicy, getStepMethods inherited from interface org.apache.hadoop.yarn.server.resourcemanager.reservation.PlanEdit
addReservation, archiveCompletedReservations, deleteReservation, setTotalCapacity, updateReservation
-
Method Details
-
getReservations
Set<ReservationAllocation> getReservations(org.apache.hadoop.yarn.api.records.ReservationId reservationID, ReservationInterval interval, String user) Return a set ofReservationAllocationidentified by the user who made the reservation.- Parameters:
reservationID- the unqiue id to identify theReservationAllocationinterval- 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
ReservationAllocationidentified by the user who made the reservation
-
getReservations
Set<ReservationAllocation> getReservations(org.apache.hadoop.yarn.api.records.ReservationId reservationID, ReservationInterval interval) Return a set ofReservationAllocationidentified by any user.- Parameters:
reservationID- the unqiue id to identify theReservationAllocationinterval- 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
ReservationAllocationidentified by any user
-
getReservationById
ReservationAllocation getReservationById(org.apache.hadoop.yarn.api.records.ReservationId reservationID) Return aReservationAllocationidentified by itsReservationId- Parameters:
reservationID- the unique id to identify theReservationAllocation- Returns:
ReservationAllocationidentified by the specified id
-
getReservationByUserAtTime
Return a set ofReservationAllocationthat belongs to a certain user and overlaps time t.- Parameters:
user- the user being consideredt- the instant in time being considered- Returns:
- set of active
ReservationAllocations for this user at this time
-
getReservationsAtTime
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 totalResourcereserved for all users at the specified time- Parameters:
tick- the time (UTC in ms) for which the reserved resources are requested- Returns:
- the total
Resourcereserved for all users at the specified time
-
getTotalCapacity
org.apache.hadoop.yarn.api.records.Resource getTotalCapacity()Returns the overall capacity in terms ofResourceassigned to this plan (typically will correspond to the absolute capacity of the corresponding queue).- Returns:
- the overall capacity in terms of
Resourceassigned 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 consideredoldId- the identifier of the existing reservationstart- 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
This method returns a RLE encoded view of the user reservation count utilization between start and end time.- Parameters:
user- the user being consideredstart- start of the time interval.end- end of the time interval.- Returns:
- RLE encoded view of reservation used over time
-
getConsumptionForUserOverTime
This method returns a RLE encoded view of the user reservation utilization between start and end time.- Parameters:
user- the user being consideredstart- 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
-