org.apache.hadoop.yarn.nodelabels

## 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 Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static void` | `checkAndThrowAttributeName(String attributeName)`
    `static void` | `checkAndThrowAttributePrefix(String prefix)`
    `static void` | `checkAndThrowAttributeValue(String value)`
    `static void` | `checkAndThrowLabelName(String label)`
    `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.
    `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.
    `static void` | `validateNodeAttributes(Set<org.apache.hadoop.yarn.api.records.NodeAttribute> attributeSet)` Validate if a given set of attributes are valid.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Method Detail

    - #### 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` -
      Throws:
        `IOException`

    - #### 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.
      Returns:
        true if they are the same

Copyright © 2008–2022 Apache Software Foundation. All rights reserved.