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,
long maxPeriodicity,
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,
long maxPeriodicty,
RMContext rmContext,
org.apache.hadoop.yarn.util.Clock clock) |
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) |
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,
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.
|
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.
|
RLESparseResourceAllocation |
getCumulativeLoadOverTime(long start,
long end)
Get the cumulative load over a time interval.
|
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 |
long |
getMaximumPeriodicity()
Returns the maximum periodicity allowed in a recurrence expression
for reservations of a particular 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, long maxPeriodicity, 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, long maxPeriodicty, RMContext rmContext, org.apache.hadoop.yarn.util.Clock clock)
public QueueMetrics getQueueMetrics()
PlanContext
QueueMetrics
for the queue in the
ResourceScheduler
corresponding to this plangetQueueMetrics
in interface PlanContext
QueueMetrics
for the queue in the
ResourceScheduler
corresponding to this planpublic Set<ReservationAllocation> getAllReservations()
public boolean addReservation(ReservationAllocation reservation, boolean isRecovering) throws PlanningException
PlanEdit
ReservationAllocation
to the plan.addReservation
in interface PlanEdit
reservation
- the ReservationAllocation
to be added to the
planisRecovering
- flag to indicate if reservation is being added as part
of failover or notPlanningException
- if addition is unsuccessfulpublic boolean updateReservation(ReservationAllocation reservation) throws PlanningException
PlanEdit
ReservationAllocation
in the plan. This is
required for re-negotiation.updateReservation
in interface PlanEdit
reservation
- the ReservationAllocation
to be updated the planPlanningException
- if update is unsuccessfulpublic boolean deleteReservation(org.apache.hadoop.yarn.api.records.ReservationId reservationID)
PlanEdit
ReservationAllocation
from the plan identified
uniquely by its ReservationId
. This will generally be used for
garbage collection.deleteReservation
in interface PlanEdit
reservationID
- the ReservationAllocation
to be deleted from
the plan identified uniquely by its ReservationId
public void archiveCompletedReservations(long tick)
PlanEdit
archiveCompletedReservations
in interface PlanEdit
tick
- the current time from which the archival window is computedpublic Set<ReservationAllocation> getReservationsAtTime(long tick)
tick
- the time (UTC in ms) for which the active reservations are
requestedpublic long getStep()
PlanContext
getStep
in interface PlanContext
public SharingPolicy getSharingPolicy()
PlanContext
SharingPolicy
that governs the sharing of the
resources of the plan between its various usersgetSharingPolicy
in interface PlanContext
SharingPolicy
that governs the sharing of
the resources of the plan between its various userspublic ReservationAgent getReservationAgent()
PlanContext
ReservationAgent
configured for this plan that is
responsible for optimally placing various reservation requestsgetReservationAgent
in interface PlanContext
ReservationAgent
configured for this planpublic RLESparseResourceAllocation getReservationCountForUserOverTime(String user, long start, long end)
user
- the user being consideredstart
- start of the time interval.end
- end of the time interval.public RLESparseResourceAllocation getConsumptionForUserOverTime(String user, long start, long end)
user
- the user being consideredstart
- start of the time interval.end
- end of the time interval.public org.apache.hadoop.yarn.api.records.Resource getTotalCommittedResources(long t)
Resource
reserved for all users at the specified
timet
- 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)
ReservationAllocation
identified by any user.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.ReservationAllocation
identified by any userpublic Set<ReservationAllocation> getReservations(org.apache.hadoop.yarn.api.records.ReservationId reservationID, ReservationInterval interval, String user)
ReservationAllocation
identified by the user who
made the reservation.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.ReservationAllocation
identified by the user who
made the reservationpublic ReservationAllocation getReservationById(org.apache.hadoop.yarn.api.records.ReservationId reservationID)
ReservationAllocation
identified by its
ReservationId
reservationID
- the unique id to identify the
ReservationAllocation
ReservationAllocation
identified by the specified idpublic org.apache.hadoop.yarn.api.records.Resource getTotalCapacity()
Resource
assigned to this
plan (typically will correspond to the absolute capacity of the
corresponding queue).Resource
assigned to this
planpublic RLESparseResourceAllocation getAvailableResourceOverTime(String user, org.apache.hadoop.yarn.api.records.ReservationId oldId, long start, long end, long period) throws PlanningException
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)PlanningException
- if operation is unsuccessfulpublic org.apache.hadoop.yarn.api.records.Resource getMinimumAllocation()
PlanContext
Resource
allocation that can be
reserved in this plangetMinimumAllocation
in interface PlanContext
Resource
allocation that can be
reserved in this planpublic void setTotalCapacity(org.apache.hadoop.yarn.api.records.Resource cap)
PlanEdit
Resource
assigned to this
plan.setTotalCapacity
in interface PlanEdit
cap
- the overall capacity in terms of Resource
assigned
to this planpublic long getEarliestStartTime()
public long getLastEndTime()
public org.apache.hadoop.yarn.util.resource.ResourceCalculator getResourceCalculator()
PlanContext
ResourceCalculator
getResourceCalculator
in interface PlanContext
ResourceCalculator
public String getQueueName()
PlanContext
ResourceScheduler
corresponding
to this plangetQueueName
in interface PlanContext
ResourceScheduler
corresponding to this planpublic org.apache.hadoop.yarn.api.records.Resource getMaximumAllocation()
PlanContext
Resource
allocation that can be reserved
in this plangetMaximumAllocation
in interface PlanContext
Resource
allocation that can be reserved
in this planpublic long getMaximumPeriodicity()
PlanContext
getMaximumPeriodicity
in interface PlanContext
public String toCumulativeString()
public Planner getReplanner()
PlanContext
Planner
, which will be invoked in response
to unexpected reduction in the resources of this plangetReplanner
in interface PlanContext
Planner
, which will be invoked in response
to unexpected reduction in the resources of this planpublic boolean getMoveOnExpiry()
PlanContext
PlanFollower
on what to do for applications
which are still running when the reservation is expiring (move-to-default
vs kill)getMoveOnExpiry
in interface PlanContext
public Set<ReservationAllocation> getReservationByUserAtTime(String user, long t)
ReservationAllocation
that belongs to a certain
user and overlaps time t.user
- the user being consideredt
- the instant in time being consideredReservationAllocation
s for this user at this
timepublic RLESparseResourceAllocation getCumulativeLoadOverTime(long start, long end) throws PlanningException
start
- start of the time interval.end
- end of the time interval.PlanningException
- if operation is unsuccessfulCopyright © 2020 Apache Software Foundation. All rights reserved.