java.lang.Object
org.apache.hadoop.yarn.server.resourcemanager.placement.csmappingrule.MappingRuleActionBase
All Implemented Interfaces:
MappingRuleAction
Direct Known Subclasses:
MappingRuleActions.PlaceToQueueAction, MappingRuleActions.RejectAction, MappingRuleActions.VariableUpdateAction

public abstract class MappingRuleActionBase extends Object implements MappingRuleAction
This class implements the fallback logic for MappingRuleActions, this can be extended to implement the actual logic of the actions, this should be a base class for most actions.
  • Constructor Details

    • MappingRuleActionBase

      public MappingRuleActionBase()
  • Method Details

    • getFallback

      public MappingRuleResult getFallback()
      Returns the fallback action to be taken if the main action (result returned by the execute method) fails. e.g. Target queue does not exist, or reference is ambiguous
      Specified by:
      getFallback in interface MappingRuleAction
      Returns:
      The fallback action to be taken if the main action fails
    • setFallbackReject

      public MappingRuleAction setFallbackReject()
      Sets the fallback method to reject, if the action cannot be executed the application will get rejected.
      Specified by:
      setFallbackReject in interface MappingRuleAction
      Returns:
      MappingRuleAction The same object for method chaining.
    • setFallbackSkip

      public MappingRuleAction setFallbackSkip()
      Sets the fallback method to skip, if the action cannot be executed We move onto the next rule, ignoring this one.
      Specified by:
      setFallbackSkip in interface MappingRuleAction
      Returns:
      MappingRuleAction The same object for method chaining.
    • setFallbackDefaultPlacement

      public MappingRuleAction setFallbackDefaultPlacement()
      Sets the fallback method to place to default, if the action cannot be executed the application will be placed into the default queue, if the default queue does not exist the application will get rejected.
      Specified by:
      setFallbackDefaultPlacement in interface MappingRuleAction
      Returns:
      MappingRuleAction The same object for method chaining.
    • execute

      public abstract MappingRuleResult execute(VariableContext variables)
      This method is the main logic of the action, it shall determine based on the mapping context, what should be the action's result.
      Specified by:
      execute in interface MappingRuleAction
      Parameters:
      variables - The variable context, which contains all the variables
      Returns:
      The result of the action