Class PlanningAlgorithm
java.lang.Object
org.apache.hadoop.yarn.server.resourcemanager.reservation.planning.PlanningAlgorithm
- All Implemented Interfaces:
ReservationAgent
- Direct Known Subclasses:
IterativePlanner
An abstract class that follows the general behavior of planning algorithms.
-
Field Summary
Fields inherited from interface org.apache.hadoop.yarn.server.resourcemanager.reservation.planning.ReservationAgent
DEFAULT_GREEDY_FAVOR_EARLY_ALLOCATION, FAVOR_EARLY_ALLOCATION -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected booleanallocateUser(org.apache.hadoop.yarn.api.records.ReservationId reservationId, String user, Plan plan, org.apache.hadoop.yarn.api.records.ReservationDefinition contract, ReservationAllocation oldReservation) Performs the actual allocation for a ReservationDefinition within a Plan.abstract RLESparseResourceAllocationcomputeJobAllocation(Plan plan, org.apache.hadoop.yarn.api.records.ReservationId reservationId, org.apache.hadoop.yarn.api.records.ReservationDefinition reservation, String user) booleancreateReservation(org.apache.hadoop.yarn.api.records.ReservationId reservationId, String user, Plan plan, org.apache.hadoop.yarn.api.records.ReservationDefinition contract) Create a reservation for the user that abides by the specified contractbooleandeleteReservation(org.apache.hadoop.yarn.api.records.ReservationId reservationId, String user, Plan plan) Delete an user reservationprotected static longfindEarliestTime(Map<ReservationInterval, org.apache.hadoop.yarn.api.records.Resource> sesInt) protected static longfindLatestTime(Map<ReservationInterval, org.apache.hadoop.yarn.api.records.Resource> sesInt) voidinit(org.apache.hadoop.conf.Configuration conf) Init configuration.protected static longstepRoundDown(long t, long step) protected static longstepRoundUp(long t, long step) booleanupdateReservation(org.apache.hadoop.yarn.api.records.ReservationId reservationId, String user, Plan plan, org.apache.hadoop.yarn.api.records.ReservationDefinition contract) Update a reservation for the user that abides by the specified contract
-
Constructor Details
-
PlanningAlgorithm
public PlanningAlgorithm()
-
-
Method Details
-
allocateUser
protected boolean allocateUser(org.apache.hadoop.yarn.api.records.ReservationId reservationId, String user, Plan plan, org.apache.hadoop.yarn.api.records.ReservationDefinition contract, ReservationAllocation oldReservation) throws PlanningException, ContractValidationException Performs the actual allocation for a ReservationDefinition within a Plan.- Parameters:
reservationId- the identifier of the reservationuser- the user who owns the reservationplan- the Plan to which the reservation must be fittedcontract- encapsulates the resources required by the user for his sessionoldReservation- the existing reservation (null if none)- Returns:
- whether the allocateUser function was successful or not
- Throws:
PlanningException- if the session cannot be fitted into the planContractValidationException- if validation fails
-
computeJobAllocation
public abstract RLESparseResourceAllocation computeJobAllocation(Plan plan, org.apache.hadoop.yarn.api.records.ReservationId reservationId, org.apache.hadoop.yarn.api.records.ReservationDefinition reservation, String user) throws PlanningException, ContractValidationException -
createReservation
public boolean createReservation(org.apache.hadoop.yarn.api.records.ReservationId reservationId, String user, Plan plan, org.apache.hadoop.yarn.api.records.ReservationDefinition contract) throws PlanningException Description copied from interface:ReservationAgentCreate a reservation for the user that abides by the specified contract- Specified by:
createReservationin interfaceReservationAgent- Parameters:
reservationId- the identifier of the reservation to be created.user- the user who wants to create the reservationplan- the Plan to which the reservation must be fittedcontract- encapsulates the resources the user requires for his session- Returns:
- whether the create operation was successful or not
- Throws:
PlanningException- if the session cannot be fitted into the plan
-
updateReservation
public boolean updateReservation(org.apache.hadoop.yarn.api.records.ReservationId reservationId, String user, Plan plan, org.apache.hadoop.yarn.api.records.ReservationDefinition contract) throws PlanningException Description copied from interface:ReservationAgentUpdate a reservation for the user that abides by the specified contract- Specified by:
updateReservationin interfaceReservationAgent- Parameters:
reservationId- the identifier of the reservation to be updateduser- the user who wants to create the sessionplan- the Plan to which the reservation must be fittedcontract- encapsulates the resources the user requires for his reservation- Returns:
- whether the update operation was successful or not
- Throws:
PlanningException- if the reservation cannot be fitted into the plan
-
deleteReservation
public boolean deleteReservation(org.apache.hadoop.yarn.api.records.ReservationId reservationId, String user, Plan plan) throws PlanningException Description copied from interface:ReservationAgentDelete an user reservation- Specified by:
deleteReservationin interfaceReservationAgent- Parameters:
reservationId- the identifier of the reservation to be deleteduser- the user who wants to create the reservationplan- the Plan to which the session must be fitted- Returns:
- whether the delete operation was successful or not
- Throws:
PlanningException- if the reservation cannot be fitted into the plan
-
findEarliestTime
protected static long findEarliestTime(Map<ReservationInterval, org.apache.hadoop.yarn.api.records.Resource> sesInt) -
findLatestTime
protected static long findLatestTime(Map<ReservationInterval, org.apache.hadoop.yarn.api.records.Resource> sesInt) -
stepRoundDown
protected static long stepRoundDown(long t, long step) -
stepRoundUp
protected static long stepRoundUp(long t, long step) -
init
public void init(org.apache.hadoop.conf.Configuration conf) Description copied from interface:ReservationAgentInit configuration.- Specified by:
initin interfaceReservationAgent- Parameters:
conf- Configuration
-