Interface PlanEdit
- All Superinterfaces:
PlanContext
- All Known Subinterfaces:
Plan
- All Known Implementing Classes:
InMemoryPlan
This interface groups the methods used to modify the state of a Plan.
-
Method Summary
Modifier and TypeMethodDescriptionbooleanaddReservation(ReservationAllocation reservation, boolean isRecovering) Add a newReservationAllocationto the plan.voidarchiveCompletedReservations(long tick) Method invoked to garbage collect old reservations.booleandeleteReservation(org.apache.hadoop.yarn.api.records.ReservationId reservationID) Delete an existingReservationAllocationfrom the plan identified uniquely by itsReservationId.Gets 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 timevoidsetTotalCapacity(org.apache.hadoop.yarn.api.records.Resource capacity) Sets the overall capacity in terms ofResourceassigned to this plan.booleanupdateReservation(ReservationAllocation reservation) Updates an existingReservationAllocationin the plan.Methods inherited from interface org.apache.hadoop.yarn.server.resourcemanager.reservation.PlanContext
getMaximumAllocation, getMaximumPeriodicity, getMinimumAllocation, getMoveOnExpiry, getQueueMetrics, getQueueName, getReplanner, getReservationAgent, getResourceCalculator, getSharingPolicy, getStep
-
Method Details
-
addReservation
boolean addReservation(ReservationAllocation reservation, boolean isRecovering) throws PlanningException Add a newReservationAllocationto the plan.- Parameters:
reservation- theReservationAllocationto be added to the planisRecovering- 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
Updates an existingReservationAllocationin the plan. This is required for re-negotiation.- Parameters:
reservation- theReservationAllocationto 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 existingReservationAllocationfrom the plan identified uniquely by itsReservationId. This will generally be used for garbage collection.- Parameters:
reservationID- theReservationAllocationto be deleted from the plan identified uniquely by itsReservationId- Returns:
- true if delete is successful, false otherwise
- Throws:
PlanningException- if deletion is unsuccessful
-
archiveCompletedReservations
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 ofResourceassigned to this plan.- Parameters:
capacity- the overall capacity in terms ofResourceassigned to this plan
-
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
-