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()
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()
PlanView
getAllReservations
in interface PlanView
public boolean addReservation(ReservationAllocation reservation, boolean isRecovering) throws PlanningException
PlanEdit
ReservationAllocation
to the planaddReservation
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
public boolean updateReservation(ReservationAllocation reservation) throws PlanningException
PlanEdit
ReservationAllocation
in the plan. This is
required for re-negotiationupdateReservation
in interface PlanEdit
reservation
- the ReservationAllocation
to be updated the planPlanningException
public 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 collectiondeleteReservation
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)
PlanView
getReservationsAtTime
in interface PlanView
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)
PlanView
getReservationCountForUserOverTime
in interface PlanView
public RLESparseResourceAllocation getConsumptionForUserOverTime(String user, long start, long end)
PlanView
getConsumptionForUserOverTime
in interface PlanView
public org.apache.hadoop.yarn.api.records.Resource getTotalCommittedResources(long t)
PlanView
Resource
reserved for all users at the specified
timegetTotalCommittedResources
in interface PlanView
t
- 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)
PlanView
ReservationAllocation
identified by any user.getReservations
in interface PlanView
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)
PlanView
ReservationAllocation
identified by the user who
made the reservation.getReservations
in interface PlanView
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)
PlanView
ReservationAllocation
identified by its
ReservationId
getReservationById
in interface PlanView
reservationID
- the unique id to identify the
ReservationAllocation
ReservationAllocation
identified by the specified idpublic org.apache.hadoop.yarn.api.records.Resource getTotalCapacity()
PlanView
Resource
assigned to this
plan (typically will correspond to the absolute capacity of the
corresponding queue).getTotalCapacity
in interface PlanView
Resource
assigned to this
planpublic RLESparseResourceAllocation getAvailableResourceOverTime(String user, org.apache.hadoop.yarn.api.records.ReservationId oldId, long start, long end) throws PlanningException
PlanView
getAvailableResourceOverTime
in interface PlanView
PlanningException
public 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
plansetTotalCapacity
in interface PlanEdit
cap
- the overall capacity in terms of Resource
assigned
to this planpublic long getEarliestStartTime()
PlanView
getEarliestStartTime
in interface PlanView
public long getLastEndTime()
PlanView
getLastEndTime
in interface PlanView
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 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)
PlanView
ReservationAllocation
that belongs to a certain
user and overlaps time t.getReservationByUserAtTime
in interface PlanView
user
- the user being consideredt
- the instant in time being consideredReservationAllocation
s for this
user at this timeCopyright © 2017 Apache Software Foundation. All Rights Reserved.