java.lang.Object
org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.QueuePath
All Implemented Interfaces:
Iterable<String>

public class QueuePath extends Object implements Iterable<String>
This is a helper class which represents a queue path, and has easy access methods to get the path's parent or leaf part, or as a whole.
  • Constructor Details

    • QueuePath

      public QueuePath(String parent, String leaf)
      Constructor to create mapping queue path from parent path and leaf name.
      Parameters:
      parent - Parent path of the queue
      leaf - Name of the leaf queue
    • QueuePath

      public QueuePath(String fullPath)
      Constructor creates a MappingQueuePath object using the queue's full path.
      Parameters:
      fullPath - Full path of the queue
  • Method Details

    • createFromQueues

      public static QueuePath createFromQueues(String... parts)
      Constructor to create Queue path from queue names. The provided queue names will be concatenated by dots, giving a full queue path.
      Parameters:
      parts - Parts of queue path
      Returns:
      QueuePath object
    • hasEmptyPart

      public boolean hasEmptyPart()
      Simple helper method to determine if the path contains any empty parts.
      Returns:
      true if there is at least one empty part of the path
    • isInvalid

      public boolean isInvalid()
      Simple helper method to determine if the queue path is invalid or not.
      Returns:
      true if the queue path is invalid.
    • getParent

      public String getParent()
      Getter for the parent part of the path.
      Returns:
      Parent path of the queue, null if there is no parent.
    • getParentObject

      public QueuePath getParentObject()
      Getter for the parent object of the path.
      Returns:
      Parent QueuePath object of the queue, null if there is no parent.
    • getLeafName

      public String getLeafName()
      Getter for the leaf part of the path.
      Returns:
      The leaf queue name
    • getFullPath

      public String getFullPath()
      Getter for the full path of the queue.
      Returns:
      Full path of the queue
    • hasParent

      public boolean hasParent()
      Convenience getter to check if the queue has a parent path defined.
      Returns:
      True if there is a parent path provided
    • isRoot

      public boolean isRoot()
      Convenience getter to check if the queue is the root queue.
      Returns:
      True if the path is root
    • createNewLeaf

      public QueuePath createNewLeaf(String childQueue)
      Creates a new QueuePath from the current full path as parent, and the appended child queue path as leaf.
      Parameters:
      childQueue - path of leaf queue
      Returns:
      new queue path made of current full path and appended leaf path
    • iterator

      public Iterator<String> iterator()
      Returns an iterator of queue path parts, starting from the highest level (generally root).
      Specified by:
      iterator in interface Iterable<String>
      Returns:
      queue part iterator
    • reverseIterator

      public Iterator<String> reverseIterator()
      Returns an iterator that provides a way to traverse the queue path from current queue through its parents.
      Returns:
      queue path iterator
    • getWildcardedQueuePaths

      public List<QueuePath> getWildcardedQueuePaths(int maxAutoCreatedQueueDepth)
      Returns the list of wildcarded queue paths based on the autoCreatedQueueDepth config value. An example template precedence hierarchy for root.a ParentQueue from highest to lowest: yarn.scheduler.capacity.root.a.auto-queue-creation-v2.template.capacity yarn.scheduler.capacity.root.*.auto-queue-creation-v2.template.capacity
      Parameters:
      maxAutoCreatedQueueDepth - the maximum depth of auto-created queues stored in the configuration
      Returns:
      list of wildcarded QueuePath objects
    • getPathComponents

      public String[] getPathComponents()
      Returns queue path components.
      Returns:
      String array containing the queue names.
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object