Interface MappingRuleValidationContext
- All Known Implementing Classes:
MappingRuleValidationContextImpl
public interface MappingRuleValidationContext
This interface represents a context which contains all methods and data
required by the mapping rules to validate the initial configuration. The
reason this is moved to a separate interface is to minimize the dependencies
of the MappingRules, MappingRuleMatchers and MappingRule actions. This
interface should contain all validation related data and functions, this way
schedulers or engines can be changed without changing the MappingRules.
-
Method Summary
Modifier and TypeMethodDescriptionvoidaddImmutableVariable(String variable) This method will add a known immutable variable to the validation context, known variables can be used to determine if a path is static or dynamic.voidaddVariable(String variable) This method will add a known variable to the validation context, known variables can be used to determine if a path is static or dynamic.This method will return all the known variables.booleanisPathStatic(String queuePath) Method to determine if the provided queue path contains any dynamic parts A part is dynamic if a known variable is referenced in it.booleanvalidateQueuePath(String queuePath) This method should determine if the provided queue path can result in a possible placement.
-
Method Details
-
validateQueuePath
This method should determine if the provided queue path can result in a possible placement. It should fail if the provided path cannot be placed into any of the known queues regardless of the variable context.- Parameters:
queuePath- The path to check- Returns:
- true if the validation was successful
- Throws:
org.apache.hadoop.yarn.exceptions.YarnException- if the provided queue path is invalid
-
isPathStatic
Method to determine if the provided queue path contains any dynamic parts A part is dynamic if a known variable is referenced in it.- Parameters:
queuePath- The path to check- Returns:
- true if no dynamic parts were found
- Throws:
org.apache.hadoop.yarn.exceptions.YarnException- if invalid path parts are found (eg. empty)
-
addVariable
This method will add a known variable to the validation context, known variables can be used to determine if a path is static or dynamic.- Parameters:
variable- Name of the variable- Throws:
org.apache.hadoop.yarn.exceptions.YarnException- If the variable to be added has already added as an immutable one, an exception is thrown
-
addImmutableVariable
This method will add a known immutable variable to the validation context, known variables can be used to determine if a path is static or dynamic.- Parameters:
variable- Name of the immutable variable- Throws:
org.apache.hadoop.yarn.exceptions.YarnException- If the variable to be added has already added as a regular, mutable variable an exception is thrown
-
getVariables
This method will return all the known variables.- Returns:
- Set of the known variables
-