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 Type
    Method
    Description
    void
    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.
    void
    addVariable(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.
    boolean
    isPathStatic(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.
    boolean
    This method should determine if the provided queue path can result in a possible placement.
  • Method Details

    • validateQueuePath

      boolean validateQueuePath(String queuePath) throws org.apache.hadoop.yarn.exceptions.YarnException
      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

      boolean isPathStatic(String queuePath) throws org.apache.hadoop.yarn.exceptions.YarnException
      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

      void addVariable(String variable) throws org.apache.hadoop.yarn.exceptions.YarnException
      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

      void addImmutableVariable(String variable) throws org.apache.hadoop.yarn.exceptions.YarnException
      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

      Set<String> getVariables()
      This method will return all the known variables.
      Returns:
      Set of the known variables