java.lang.Object
org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.QueueManager

@Private @Unstable public class QueueManager extends Object
Maintains a list of queues as well as scheduling parameters for each queue, such as guaranteed share allocations, from the fair scheduler config file.
  • Field Details

  • Constructor Details

  • Method Details

    • getRootQueue

      public FSParentQueue getRootQueue()
    • initialize

      public void initialize()
    • getLeafQueue

      public FSLeafQueue getLeafQueue(String name, boolean create)
      Get a leaf queue by name, creating it if the create param is true and the queue does not exist. If the queue is not or can not be a leaf queue, i.e. it already exists as a parent queue, or one of the parents in its name is already a leaf queue, null is returned. The root part of the name is optional, so a queue underneath the root named "queue1" could be referred to as just "queue1", and a queue named "queue2" underneath a parent named "parent1" that is underneath the root could be referred to as just "parent1.queue2".
      Parameters:
      name - name of the queue
      create - true if the queue must be created if it does not exist, false otherwise
      Returns:
      the leaf queue or null if the queue cannot be found
    • getLeafQueue

      public FSLeafQueue getLeafQueue(String name, boolean create, org.apache.hadoop.yarn.api.records.ApplicationId applicationId)
      Get a leaf queue by name, creating it if the create param is true and the queue does not exist. If the queue is not or can not be a leaf queue, i.e. it already exists as a parent queue, or one of the parents in its name is already a leaf queue, null is returned. If the application will be assigned to the queue if the applicationId is not null
      Parameters:
      name - name of the queue
      create - true if the queue must be created if it does not exist, false otherwise
      applicationId - the application ID to assign to the queue
      Returns:
      the leaf queue or null if teh queue cannot be found
    • removeLeafQueue

      public boolean removeLeafQueue(String name)
      Remove a leaf queue if empty.
      Parameters:
      name - name of the queue
      Returns:
      true if queue was removed or false otherwise
    • getParentQueue

      public FSParentQueue getParentQueue(String name, boolean create)
      Get a parent queue by name, creating it if the create param is true and the queue does not exist. If the queue is not or can not be a parent queue, i.e. it already exists as a leaf queue, or one of the parents in its name is already a leaf queue, null is returned. The root part of the name is optional, so a queue underneath the root named "queue1" could be referred to as just "queue1", and a queue named "queue2" underneath a parent named "parent1" that is underneath the root could be referred to as just "parent1.queue2".
      Parameters:
      name - name of the queue
      create - true if the queue must be created if it does not exist, false otherwise
      Returns:
      the parent queue or null if the queue cannot be found
    • getParentQueue

      public FSParentQueue getParentQueue(String name, boolean create, boolean recomputeSteadyShares)
      Get a parent queue by name, creating it if the create param is true and the queue does not exist. If the queue is not or can not be a parent queue, i.e. it already exists as a leaf queue, or one of the parents in its name is already a leaf queue, null is returned. The root part of the name is optional, so a queue underneath the root named "queue1" could be referred to as just "queue1", and a queue named "queue2" underneath a parent named "parent1" that is underneath the root could be referred to as just "parent1.queue2".
      Parameters:
      name - name of the queue
      create - true if the queue must be created if it does not exist, false otherwise
      recomputeSteadyShares - true if the steady fair share should be recalculated when a queue is added, false otherwise
      Returns:
      the parent queue or null if the queue cannot be found
    • removeEmptyDynamicQueues

      public void removeEmptyDynamicQueues()
      Removes all empty dynamic queues (including empty dynamic parent queues).
    • removePendingIncompatibleQueues

      public void removePendingIncompatibleQueues()
      Re-checking incompatible queues that could not be removed earlier due to not being empty, and removing those that became empty.
    • getQueue

      public FSQueue getQueue(String name)
      Gets a queue by name.
      Parameters:
      name - queue name.
      Returns:
      queue objects, FSQueue.
    • exists

      public boolean exists(String name)
      Return whether a queue exists already.
      Parameters:
      name - queue name.
      Returns:
      Returns true if the queue exists, otherwise returns false.
    • getLeafQueues

      public Collection<FSLeafQueue> getLeafQueues()
      Get a collection of all leaf queues.
      Returns:
      a collection of all leaf queues.
    • getQueues

      public Collection<FSQueue> getQueues()
      Get a collection of all queues.
      Returns:
      a collection of all queues.
    • updateAllocationConfiguration

      public void updateAllocationConfiguration(AllocationConfiguration queueConf)
    • setQueuesToDynamic

      protected void setQueuesToDynamic(Set<String> queueNames)
      Setting a set of queues to dynamic.
      Parameters:
      queueNames - The names of the queues to be set to dynamic