Class NodeLabelUtil

java.lang.Object
org.apache.hadoop.yarn.nodelabels.NodeLabelUtil

public final class NodeLabelUtil extends Object
Utility class for all NodeLabel and NodeAttribute operations.
  • Method Details

    • checkAndThrowLabelName

      public static void checkAndThrowLabelName(String label) throws IOException
      Throws:
      IOException
    • checkAndThrowAttributeName

      public static void checkAndThrowAttributeName(String attributeName) throws IOException
      Throws:
      IOException
    • checkAndThrowAttributeValue

      public static void checkAndThrowAttributeValue(String value) throws IOException
      Throws:
      IOException
    • checkAndThrowAttributePrefix

      public static void checkAndThrowAttributePrefix(String prefix) throws IOException
      Throws:
      IOException
    • validateNodeAttributes

      public static void validateNodeAttributes(Set<org.apache.hadoop.yarn.api.records.NodeAttribute> attributeSet) throws IOException
      Validate if a given set of attributes are valid. Attributes could be invalid if any of following conditions is met:
      • Missing prefix: the attribute doesn't have prefix defined
      • Malformed attribute prefix: the prefix is not in valid format
      Parameters:
      attributeSet - node attribute set.
      Throws:
      IOException - io error occur.
    • filterAttributesByPrefix

      public static Set<org.apache.hadoop.yarn.api.records.NodeAttribute> filterAttributesByPrefix(Set<org.apache.hadoop.yarn.api.records.NodeAttribute> attributeSet, String prefix)
      Filter a set of node attributes by a given prefix. Returns a filtered set of node attributes whose prefix equals the given prefix. If the prefix is null or empty, then the original set is returned.
      Parameters:
      attributeSet - node attribute set
      prefix - node attribute prefix
      Returns:
      a filtered set of node attributes
    • isNodeAttributesEquals

      public static boolean isNodeAttributesEquals(Set<org.apache.hadoop.yarn.api.records.NodeAttribute> leftNodeAttributes, Set<org.apache.hadoop.yarn.api.records.NodeAttribute> rightNodeAttributes)
      Are these two input node attributes the same.
      Parameters:
      leftNodeAttributes - left node attribute.
      rightNodeAttributes - right node attribute.
      Returns:
      true if they are the same