Class PlacementRule
java.lang.Object
org.apache.hadoop.yarn.server.resourcemanager.placement.PlacementRule
- Direct Known Subclasses:
CSMappingPlacementRule,FSPlacementRule
Abstract base for all Placement Rules.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetName()Return the name of the rule.abstract ApplicationPlacementContextgetPlacementForApp(org.apache.hadoop.yarn.api.records.ApplicationSubmissionContext asc, String user) Return the scheduler queue name the application should be placed in wrapped in anApplicationPlacementContextobject.getPlacementForApp(org.apache.hadoop.yarn.api.records.ApplicationSubmissionContext asc, String user, boolean recovery) Return the scheduler queue name the application should be placed in wrapped in anApplicationPlacementContextobject.abstract booleaninitialize(ResourceScheduler scheduler) Initialize the rule with the scheduler.voidSet the config based on the passed in argument.
-
Constructor Details
-
PlacementRule
public PlacementRule()
-
-
Method Details
-
setConfig
Set the config based on the passed in argument. This construct is used to not pollute this abstract class with implementation specific references.- Parameters:
initArg- initialization arguments.
-
getName
Return the name of the rule.- Returns:
- The name of the rule, the fully qualified class name.
-
initialize
Initialize the rule with the scheduler.- Parameters:
scheduler- the scheduler using the rule- Returns:
trueorfalseThe outcome of the initialisation, rule dependent response which might not be persisted in the rule.- Throws:
IOException- for any errors
-
getPlacementForApp
public abstract ApplicationPlacementContext getPlacementForApp(org.apache.hadoop.yarn.api.records.ApplicationSubmissionContext asc, String user) throws org.apache.hadoop.yarn.exceptions.YarnException Return the scheduler queue name the application should be placed in wrapped in anApplicationPlacementContextobject. A nonnullreturn value places the application in a queue, anullvalue means the queue is not yet determined. The nextPlacementRulein the list maintained in thePlacementManagerwill be executed.- Parameters:
asc- The context of the application created on submissionuser- The name of the user submitting the application- Returns:
- The queue name wrapped in
ApplicationPlacementContextornullif no queue was resolved - Throws:
org.apache.hadoop.yarn.exceptions.YarnException- for any error while executing the rule
-
getPlacementForApp
public ApplicationPlacementContext getPlacementForApp(org.apache.hadoop.yarn.api.records.ApplicationSubmissionContext asc, String user, boolean recovery) throws org.apache.hadoop.yarn.exceptions.YarnException Return the scheduler queue name the application should be placed in wrapped in anApplicationPlacementContextobject. A nonnullreturn value places the application in a queue, anullvalue means the queue is not yet determined. The nextPlacementRulein the list maintained in thePlacementManagerwill be executed.- Parameters:
asc- The context of the application created on submissionuser- The name of the user submitting the applicationrecovery- Indicates if the submission is a recovery- Returns:
- The queue name wrapped in
ApplicationPlacementContextornullif no queue was resolved - Throws:
org.apache.hadoop.yarn.exceptions.YarnException- for any error while executing the rule
-