java.lang.Object
org.apache.hadoop.yarn.server.resourcemanager.placement.PlacementRule
Direct Known Subclasses:
CSMappingPlacementRule, FSPlacementRule

@Private @Unstable public abstract class PlacementRule extends Object
Abstract base for all Placement Rules.
  • Constructor Details

    • PlacementRule

      public PlacementRule()
  • Method Details

    • setConfig

      public void setConfig(Object initArg)
      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

      public String getName()
      Return the name of the rule.
      Returns:
      The name of the rule, the fully qualified class name.
    • initialize

      public abstract boolean initialize(ResourceScheduler scheduler) throws IOException
      Initialize the rule with the scheduler.
      Parameters:
      scheduler - the scheduler using the rule
      Returns:
      true or false The 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 an ApplicationPlacementContext object. A non null return value places the application in a queue, a null value means the queue is not yet determined. The next PlacementRule in the list maintained in the PlacementManager will be executed.
      Parameters:
      asc - The context of the application created on submission
      user - The name of the user submitting the application
      Returns:
      The queue name wrapped in ApplicationPlacementContext or null if 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 an ApplicationPlacementContext object. A non null return value places the application in a queue, a null value means the queue is not yet determined. The next PlacementRule in the list maintained in the PlacementManager will be executed.
      Parameters:
      asc - The context of the application created on submission
      user - The name of the user submitting the application
      recovery - Indicates if the submission is a recovery
      Returns:
      The queue name wrapped in ApplicationPlacementContext or null if no queue was resolved
      Throws:
      org.apache.hadoop.yarn.exceptions.YarnException - for any error while executing the rule