org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair
Class QueueManager

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

@InterfaceAudience.Private
@InterfaceStability.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 Summary
static long ALLOC_RELOAD_INTERVAL
          Time to wait between checks of the allocation file
static long ALLOC_RELOAD_WAIT
          Time to wait after the allocation has been modified before reloading it (this is done to prevent loading a file that hasn't been fully written).
static org.apache.commons.logging.Log LOG
           
static String ROOT_QUEUE
           
 
Constructor Summary
QueueManager(FairScheduler scheduler)
           
 
Method Summary
 boolean exists(String name)
          Return whether a queue exists already.
 long getFairSharePreemptionTimeout()
          Get the fair share preemption, in milliseconds.
 FSLeafQueue getLeafQueue(String name, boolean create)
          Get a queue by name, creating it if the create param is true and is necessary.
 Collection<FSLeafQueue> getLeafQueues()
          Get a collection of all leaf queues
 org.apache.hadoop.yarn.api.records.Resource getMaxResources(String queueName)
          Get the maximum resource allocation for the given queue.
 org.apache.hadoop.yarn.api.records.Resource getMinResources(String queue)
          Get the minimum resource allocation for the given queue.
 long getMinSharePreemptionTimeout(String queueName)
          Get a queue's min share preemption timeout, in milliseconds.
 FSQueue getQueue(String name)
          Gets a queue by name.
 org.apache.hadoop.security.authorize.AccessControlList getQueueAcl(String queue, org.apache.hadoop.yarn.api.records.QueueACL operation)
          Get the ACLs associated with this queue.
 int getQueueMaxApps(String queue)
           
 Collection<FSQueue> getQueues()
          Get a collection of all queues
 ResourceWeights getQueueWeight(String queue)
           
 FSParentQueue getRootQueue()
           
 int getUserMaxApps(String user)
           
 void initialize()
           
 void reloadAllocs()
          Updates the allocation list from the allocation config file.
 void reloadAllocsIfNecessary()
          Reload allocations file if it hasn't been loaded in a while
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOG

public static final org.apache.commons.logging.Log LOG

ROOT_QUEUE

public static final String ROOT_QUEUE
See Also:
Constant Field Values

ALLOC_RELOAD_INTERVAL

public static final long ALLOC_RELOAD_INTERVAL
Time to wait between checks of the allocation file

See Also:
Constant Field Values

ALLOC_RELOAD_WAIT

public static final long ALLOC_RELOAD_WAIT
Time to wait after the allocation has been modified before reloading it (this is done to prevent loading a file that hasn't been fully written).

See Also:
Constant Field Values
Constructor Detail

QueueManager

public QueueManager(FairScheduler scheduler)
Method Detail

getRootQueue

public FSParentQueue getRootQueue()

initialize

public void initialize()
                throws IOException,
                       SAXException,
                       AllocationConfigurationException,
                       ParserConfigurationException
Throws:
IOException
SAXException
AllocationConfigurationException
ParserConfigurationException

getLeafQueue

public FSLeafQueue getLeafQueue(String name,
                                boolean create)
Get a queue by name, creating it if the create param is true and is necessary. 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".


getQueue

public FSQueue getQueue(String name)
Gets a queue by name.


exists

public boolean exists(String name)
Return whether a queue exists already.


reloadAllocsIfNecessary

public void reloadAllocsIfNecessary()
Reload allocations file if it hasn't been loaded in a while


reloadAllocs

public void reloadAllocs()
                  throws IOException,
                         ParserConfigurationException,
                         SAXException,
                         AllocationConfigurationException
Updates the allocation list from the allocation config file. This file is expected to be in the XML format specified in the design doc.

Throws:
IOException - if the config file cannot be read.
AllocationConfigurationException - if allocations are invalid.
ParserConfigurationException - if XML parser is misconfigured.
SAXException - if config file is malformed.

getMinResources

public org.apache.hadoop.yarn.api.records.Resource getMinResources(String queue)
Get the minimum resource allocation for the given queue.

Returns:
the cap set on this queue, or 0 if not set.

getMaxResources

public org.apache.hadoop.yarn.api.records.Resource getMaxResources(String queueName)
Get the maximum resource allocation for the given queue.

Returns:
the cap set on this queue, or Integer.MAX_VALUE if not set.

getLeafQueues

public Collection<FSLeafQueue> getLeafQueues()
Get a collection of all leaf queues


getQueues

public Collection<FSQueue> getQueues()
Get a collection of all queues


getUserMaxApps

public int getUserMaxApps(String user)

getQueueMaxApps

public int getQueueMaxApps(String queue)

getQueueWeight

public ResourceWeights getQueueWeight(String queue)

getMinSharePreemptionTimeout

public long getMinSharePreemptionTimeout(String queueName)
Get a queue's min share preemption timeout, in milliseconds. This is the time after which jobs in the queue may kill other queues' tasks if they are below their min share.


getFairSharePreemptionTimeout

public long getFairSharePreemptionTimeout()
Get the fair share preemption, in milliseconds. This is the time after which any job may kill other jobs' tasks if it is below half its fair share.


getQueueAcl

public org.apache.hadoop.security.authorize.AccessControlList getQueueAcl(String queue,
                                                                          org.apache.hadoop.yarn.api.records.QueueACL operation)
Get the ACLs associated with this queue. If a given ACL is not explicitly configured, include the default value for that ACL. The default for the root queue is everybody ("*") and the default for all other queues is nobody ("")



Copyright © 2014 Apache Software Foundation. All Rights Reserved.