public class InMemoryPlan extends Object implements Plan
| Constructor and Description |
|---|
InMemoryPlan(QueueMetrics queueMetrics,
SharingPolicy policy,
ReservationAgent agent,
org.apache.hadoop.yarn.api.records.Resource totalCapacity,
long step,
org.apache.hadoop.yarn.util.resource.ResourceCalculator resCalc,
org.apache.hadoop.yarn.api.records.Resource minAlloc,
org.apache.hadoop.yarn.api.records.Resource maxAlloc,
String queueName,
Planner replanner,
boolean getMoveOnExpiry,
RMContext rmContext) |
InMemoryPlan(QueueMetrics queueMetrics,
SharingPolicy policy,
ReservationAgent agent,
org.apache.hadoop.yarn.api.records.Resource totalCapacity,
long step,
org.apache.hadoop.yarn.util.resource.ResourceCalculator resCalc,
org.apache.hadoop.yarn.api.records.Resource minAlloc,
org.apache.hadoop.yarn.api.records.Resource maxAlloc,
String queueName,
Planner replanner,
boolean getMoveOnExpiry,
RMContext rmContext,
org.apache.hadoop.yarn.util.Clock clock) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
addReservation(ReservationAllocation reservation,
boolean isRecovering)
Add a new
ReservationAllocation to the plan |
void |
archiveCompletedReservations(long tick)
Method invoked to garbage collect old reservations.
|
boolean |
deleteReservation(org.apache.hadoop.yarn.api.records.ReservationId reservationID)
Delete an existing
ReservationAllocation from the plan identified
uniquely by its ReservationId. |
Set<ReservationAllocation> |
getAllReservations()
Gets all the reservations in the plan
|
RLESparseResourceAllocation |
getAvailableResourceOverTime(String user,
org.apache.hadoop.yarn.api.records.ReservationId oldId,
long start,
long end)
This method returns the amount of resources available to a given user
(optionally if removing a certain reservation) over the start-end time
range.
|
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.
|
long |
getEarliestStartTime()
Gets the time (UTC in ms) at which the first reservation starts
|
long |
getLastEndTime()
Returns the time (UTC in ms) at which the last reservation terminates
|
org.apache.hadoop.yarn.api.records.Resource |
getMaximumAllocation()
Returns the single largest
Resource allocation that can be reserved
in this plan |
org.apache.hadoop.yarn.api.records.Resource |
getMinimumAllocation()
Returns the single smallest
Resource allocation that can be
reserved in this plan |
boolean |
getMoveOnExpiry()
Instructs the
PlanFollower on what to do for applications
which are still running when the reservation is expiring (move-to-default
vs kill) |
QueueMetrics |
getQueueMetrics()
Return the
QueueMetrics for the queue in the
ResourceScheduler corresponding to this plan |
String |
getQueueName()
Return the name of the queue in the
ResourceScheduler corresponding
to this plan |
Planner |
getReplanner()
Return an instance of a
Planner, which will be invoked in response
to unexpected reduction in the resources of this plan |
ReservationAgent |
getReservationAgent()
Return the
ReservationAgent configured for this plan that is
responsible for optimally placing various reservation requests |
ReservationAllocation |
getReservationById(org.apache.hadoop.yarn.api.records.ReservationId reservationID)
Return a
ReservationAllocation identified by its
ReservationId |
Set<ReservationAllocation> |
getReservationByUserAtTime(String user,
long t)
Return a set of
ReservationAllocation that belongs to a certain
user and overlaps time t. |
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.
|
Set<ReservationAllocation> |
getReservations(org.apache.hadoop.yarn.api.records.ReservationId reservationID,
ReservationInterval interval)
Return a set of
ReservationAllocation identified by any user. |
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. |
Set<ReservationAllocation> |
getReservationsAtTime(long tick)
Gets all the active reservations at the specified point of time
|
org.apache.hadoop.yarn.util.resource.ResourceCalculator |
getResourceCalculator()
Returns the system
ResourceCalculator |
SharingPolicy |
getSharingPolicy()
Return the configured
SharingPolicy that governs the sharing of the
resources of the plan between its various users |
long |
getStep()
Returns the configured "step" or granularity of time of the plan in millis.
|
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). |
org.apache.hadoop.yarn.api.records.Resource |
getTotalCommittedResources(long t)
Returns the total
Resource reserved for all users at the specified
time |
void |
setTotalCapacity(org.apache.hadoop.yarn.api.records.Resource cap)
Sets the overall capacity in terms of
Resource assigned to this
plan |
String |
toCumulativeString() |
String |
toString() |
boolean |
updateReservation(ReservationAllocation reservation)
Updates an existing
ReservationAllocation in the plan. |
public InMemoryPlan(QueueMetrics queueMetrics, SharingPolicy policy, ReservationAgent agent, org.apache.hadoop.yarn.api.records.Resource totalCapacity, long step, org.apache.hadoop.yarn.util.resource.ResourceCalculator resCalc, org.apache.hadoop.yarn.api.records.Resource minAlloc, org.apache.hadoop.yarn.api.records.Resource maxAlloc, String queueName, Planner replanner, boolean getMoveOnExpiry, RMContext rmContext)
public InMemoryPlan(QueueMetrics queueMetrics, SharingPolicy policy, ReservationAgent agent, org.apache.hadoop.yarn.api.records.Resource totalCapacity, long step, org.apache.hadoop.yarn.util.resource.ResourceCalculator resCalc, org.apache.hadoop.yarn.api.records.Resource minAlloc, org.apache.hadoop.yarn.api.records.Resource maxAlloc, String queueName, Planner replanner, boolean getMoveOnExpiry, RMContext rmContext, org.apache.hadoop.yarn.util.Clock clock)
public QueueMetrics getQueueMetrics()
PlanContextQueueMetrics for the queue in the
ResourceScheduler corresponding to this plangetQueueMetrics in interface PlanContextQueueMetrics for the queue in the
ResourceScheduler corresponding to this planpublic Set<ReservationAllocation> getAllReservations()
PlanViewgetAllReservations in interface PlanViewpublic boolean addReservation(ReservationAllocation reservation, boolean isRecovering) throws PlanningException
PlanEditReservationAllocation to the planaddReservation in interface PlanEditreservation - the ReservationAllocation to be added to the
planisRecovering - flag to indicate if reservation is being added as part
of failover or notPlanningExceptionpublic boolean updateReservation(ReservationAllocation reservation) throws PlanningException
PlanEditReservationAllocation in the plan. This is
required for re-negotiationupdateReservation in interface PlanEditreservation - the ReservationAllocation to be updated the planPlanningExceptionpublic boolean deleteReservation(org.apache.hadoop.yarn.api.records.ReservationId reservationID)
PlanEditReservationAllocation from the plan identified
uniquely by its ReservationId. This will generally be used for
garbage collectiondeleteReservation in interface PlanEditreservationID - the ReservationAllocation to be deleted from
the plan identified uniquely by its ReservationIdpublic void archiveCompletedReservations(long tick)
PlanEditarchiveCompletedReservations in interface PlanEdittick - the current time from which the archival window is computedpublic Set<ReservationAllocation> getReservationsAtTime(long tick)
PlanViewgetReservationsAtTime in interface PlanViewtick - the time (UTC in ms) for which the active reservations are
requestedpublic long getStep()
PlanContextgetStep in interface PlanContextpublic SharingPolicy getSharingPolicy()
PlanContextSharingPolicy that governs the sharing of the
resources of the plan between its various usersgetSharingPolicy in interface PlanContextSharingPolicy that governs the sharing of
the resources of the plan between its various userspublic ReservationAgent getReservationAgent()
PlanContextReservationAgent configured for this plan that is
responsible for optimally placing various reservation requestsgetReservationAgent in interface PlanContextReservationAgent configured for this planpublic RLESparseResourceAllocation getReservationCountForUserOverTime(String user, long start, long end)
PlanViewgetReservationCountForUserOverTime in interface PlanViewpublic RLESparseResourceAllocation getConsumptionForUserOverTime(String user, long start, long end)
PlanViewgetConsumptionForUserOverTime in interface PlanViewpublic org.apache.hadoop.yarn.api.records.Resource getTotalCommittedResources(long t)
PlanViewResource reserved for all users at the specified
timegetTotalCommittedResources in interface PlanViewt - the time (UTC in ms) for which the reserved resources are
requestedResource reserved for all users at the specified
timepublic Set<ReservationAllocation> getReservations(org.apache.hadoop.yarn.api.records.ReservationId reservationID, ReservationInterval interval)
PlanViewReservationAllocation identified by any user.getReservations in interface PlanViewreservationID - the unqiue id to identify the
ReservationAllocationinterval - 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.ReservationAllocation identified by any userpublic Set<ReservationAllocation> getReservations(org.apache.hadoop.yarn.api.records.ReservationId reservationID, ReservationInterval interval, String user)
PlanViewReservationAllocation identified by the user who
made the reservation.getReservations in interface PlanViewreservationID - the unqiue id to identify the
ReservationAllocationinterval - 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.ReservationAllocation identified by the user who
made the reservationpublic ReservationAllocation getReservationById(org.apache.hadoop.yarn.api.records.ReservationId reservationID)
PlanViewReservationAllocation identified by its
ReservationIdgetReservationById in interface PlanViewreservationID - the unique id to identify the
ReservationAllocationReservationAllocation identified by the specified idpublic org.apache.hadoop.yarn.api.records.Resource getTotalCapacity()
PlanViewResource assigned to this
plan (typically will correspond to the absolute capacity of the
corresponding queue).getTotalCapacity in interface PlanViewResource assigned to this
planpublic RLESparseResourceAllocation getAvailableResourceOverTime(String user, org.apache.hadoop.yarn.api.records.ReservationId oldId, long start, long end) throws PlanningException
PlanViewgetAvailableResourceOverTime in interface PlanViewPlanningExceptionpublic org.apache.hadoop.yarn.api.records.Resource getMinimumAllocation()
PlanContextResource allocation that can be
reserved in this plangetMinimumAllocation in interface PlanContextResource allocation that can be
reserved in this planpublic void setTotalCapacity(org.apache.hadoop.yarn.api.records.Resource cap)
PlanEditResource assigned to this
plansetTotalCapacity in interface PlanEditcap - the overall capacity in terms of Resource assigned
to this planpublic long getEarliestStartTime()
PlanViewgetEarliestStartTime in interface PlanViewpublic long getLastEndTime()
PlanViewgetLastEndTime in interface PlanViewpublic org.apache.hadoop.yarn.util.resource.ResourceCalculator getResourceCalculator()
PlanContextResourceCalculatorgetResourceCalculator in interface PlanContextResourceCalculatorpublic String getQueueName()
PlanContextResourceScheduler corresponding
to this plangetQueueName in interface PlanContextResourceScheduler
corresponding to this planpublic org.apache.hadoop.yarn.api.records.Resource getMaximumAllocation()
PlanContextResource allocation that can be reserved
in this plangetMaximumAllocation in interface PlanContextResource allocation that can be reserved
in this planpublic String toCumulativeString()
public Planner getReplanner()
PlanContextPlanner, which will be invoked in response
to unexpected reduction in the resources of this plangetReplanner in interface PlanContextPlanner, which will be invoked in response
to unexpected reduction in the resources of this planpublic boolean getMoveOnExpiry()
PlanContextPlanFollower on what to do for applications
which are still running when the reservation is expiring (move-to-default
vs kill)getMoveOnExpiry in interface PlanContextpublic Set<ReservationAllocation> getReservationByUserAtTime(String user, long t)
PlanViewReservationAllocation that belongs to a certain
user and overlaps time t.getReservationByUserAtTime in interface PlanViewuser - the user being consideredt - the instant in time being consideredReservationAllocations for this
user at this timeCopyright © 2017 Apache Software Foundation. All Rights Reserved.