Class MappingRule
java.lang.Object
org.apache.hadoop.yarn.server.resourcemanager.placement.csmappingrule.MappingRule
Mapping rule represents a single mapping setting defined by the user. All
rules have matchers and actions. Matcher determine if a mapping rule applies
to a given applicationSubmission, while action represent the course of action
we need to take when a rule applies.
MappingRules also support fallback actions, which will be evaluated when the
main action fails due to any reason (Eg. trying to place to a queue which
does not exist)
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic MappingRulecreateLegacyRule(String source, String path) Creates a MappingRule object from the legacy style configuration.static MappingRulecreateLegacyRule(String type, String source, String path) Creates a MappingRule object from the legacy style configuration.evaluate(VariableContext variables) This method evaluates the rule, and returns the MappingRuleResult, if the rule matches, skip action otherwise.Returns the associated action's fallback.toString()void
-
Field Details
-
USER_MAPPING
- See Also:
-
GROUP_MAPPING
- See Also:
-
APPLICATION_MAPPING
- See Also:
-
-
Constructor Details
-
MappingRule
-
-
Method Details
-
evaluate
This method evaluates the rule, and returns the MappingRuleResult, if the rule matches, skip action otherwise.- Parameters:
variables- The variable context, which contains all the variables- Returns:
- The rule's result or skip action if the rule doesn't apply
-
getFallback
Returns the associated action's fallback.- Returns:
- The fallback of the action
-
createLegacyRule
Creates a MappingRule object from the legacy style configuration. The configuration is a [TYPE]:SOURCE:PATH (eg. u:bob:root.users.%user). Using the source and path parts of the legacy rule, this method will create an application MappingRule which behaves as the legacy rule defined. This version of the method does not require type, since legacy application mappings omitted the 'a', so this method is to be used for those rules, which in all case are application mappings.- Parameters:
source- This part of the rule determines which applications the rule will be appliedpath- The path where the application is to be placed- Returns:
- MappingRule based on the provided settings
-
createLegacyRule
Creates a MappingRule object from the legacy style configuration. The configuration is a [TYPE]:SOURCE:PATH (eg. u:bob:root.users.%user). Using the type, source and path parts of the legacy rule, this method will create a MappingRule which behaves as the legacy rule defined.- Parameters:
type- The type of the rule, can be 'u' for user mapping, 'g' for group mapping or 'a' for application mappingsource- This part of the rule determines which submissions this rule should apply to (eg. if type is 'u', source will match against the user name)path- The path where the application is to be placed- Returns:
- MappingRule based on the provided settings
-
validate
public void validate(MappingRuleValidationContext ctx) throws org.apache.hadoop.yarn.exceptions.YarnException - Throws:
org.apache.hadoop.yarn.exceptions.YarnException
-
toString
-