org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity
Class LeafQueue

java.lang.Object
  extended by org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.LeafQueue
All Implemented Interfaces:
CSQueue, Queue

@InterfaceAudience.Private
@InterfaceStability.Unstable
public class LeafQueue
extends Object
implements CSQueue


Constructor Summary
LeafQueue(CapacitySchedulerContext cs, String queueName, CSQueue parent, CSQueue old)
           
 
Method Summary
 CSAssignment assignContainers(org.apache.hadoop.yarn.api.records.Resource clusterResource, FiCaSchedulerNode node)
          Assign containers to applications in the queue or it's children (if any).
 void completedContainer(org.apache.hadoop.yarn.api.records.Resource clusterResource, FiCaSchedulerApp application, FiCaSchedulerNode node, RMContainer rmContainer, org.apache.hadoop.yarn.api.records.ContainerStatus containerStatus, RMContainerEventType event, CSQueue childQueue)
          A container assigned to the queue has completed.
 void finishApplication(FiCaSchedulerApp application, String queue)
          An application submitted to this queue has finished.
 float getAbsoluteCapacity()
          Get capacity of the parent of the queue as a function of the cumulative capacity in the cluster.
 float getAbsoluteMaximumCapacity()
          Get maximum-capacity of the queue as a funciton of the cumulative capacity of the cluster.
 float getAbsoluteUsedCapacity()
          Get the current absolute used capacity of the queue relative to the entire cluster.
 ActiveUsersManager getActiveUsersManager()
          Get the ActiveUsersManager for the queue.
 Set<FiCaSchedulerApp> getApplications()
          Obtain (read-only) collection of active applications.
 float getCapacity()
          Get the configured capacity of the queue.
 List<CSQueue> getChildQueues()
          Get child queues
 float getMaxAMResourcePerQueuePercent()
          Used only by tests.
 int getMaxApplications()
           
 int getMaxApplicationsPerUser()
           
 int getMaximumActiveApplications()
           
 int getMaximumActiveApplicationsPerUser()
           
 org.apache.hadoop.yarn.api.records.Resource getMaximumAllocation()
          Used only by tests.
 float getMaximumCapacity()
          Get the configured maximum-capacity of the queue.
 QueueMetrics getMetrics()
          Get the queue metrics
 org.apache.hadoop.yarn.api.records.Resource getMinimumAllocation()
          Used only by tests.
 float getMinimumAllocationFactor()
          Used only by tests.
 int getNodeLocalityDelay()
           
 int getNumActiveApplications()
           
 int getNumActiveApplications(String user)
           
 int getNumApplications()
          Get the number of applications in the queue.
 int getNumApplications(String user)
           
 int getNumContainers()
           
 int getNumPendingApplications()
           
 int getNumPendingApplications(String user)
           
 CSQueue getParent()
          Get the parent Queue.
 org.apache.hadoop.yarn.api.records.QueueInfo getQueueInfo(boolean includeChildQueues, boolean recursive)
          Get queue information
 String getQueueName()
          Get the queue name.
 String getQueuePath()
          Get the full name of the queue, including the heirarchy.
 List<org.apache.hadoop.yarn.api.records.QueueUserACLInfo> getQueueUserAclInfo(org.apache.hadoop.security.UserGroupInformation user)
          Get queue ACLs for given user.
 org.apache.hadoop.yarn.api.records.QueueState getState()
          Get the current run-state of the queue
 org.apache.hadoop.yarn.api.records.Resource getTotalResourcePending()
           
 float getUsedCapacity()
          Get the current used capacity of the queue and it's children (if any).
 org.apache.hadoop.yarn.api.records.Resource getUsedResources()
          Get the currently utilized resources in the cluster by the queue and children (if any).
 int getUserLimit()
           
 float getUserLimitFactor()
           
 ArrayList<UserInfo> getUsers()
           
 boolean hasAccess(org.apache.hadoop.yarn.api.records.QueueACL acl, org.apache.hadoop.security.UserGroupInformation user)
          Check if the user has permission to perform the operation
 void recoverContainer(org.apache.hadoop.yarn.api.records.Resource clusterResource, FiCaSchedulerApp application, org.apache.hadoop.yarn.api.records.Container container)
          Recover the state of the queue
 void reinitialize(CSQueue newlyParsedQueue, org.apache.hadoop.yarn.api.records.Resource clusterResource)
          Reinitialize the queue.
 void removeApplication(FiCaSchedulerApp application, org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.LeafQueue.User user)
           
 void setAbsoluteUsedCapacity(float absUsedCapacity)
          Set absolute used capacity of the queue.
 void setParent(CSQueue newParentQueue)
          Set the parent Queue.
 void setUsedCapacity(float usedCapacity)
          Set used capacity of the queue.
 void submitApplication(FiCaSchedulerApp application, String userName, String queue)
          Submit a new application to the queue.
 String toString()
           
 void updateClusterResource(org.apache.hadoop.yarn.api.records.Resource clusterResource)
          Update the cluster resource for queues as we add/remove nodes
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

LeafQueue

public LeafQueue(CapacitySchedulerContext cs,
                 String queueName,
                 CSQueue parent,
                 CSQueue old)
Method Detail

getCapacity

public float getCapacity()
Description copied from interface: CSQueue
Get the configured capacity of the queue.

Specified by:
getCapacity in interface CSQueue
Returns:
queue capacity

getAbsoluteCapacity

public float getAbsoluteCapacity()
Description copied from interface: CSQueue
Get capacity of the parent of the queue as a function of the cumulative capacity in the cluster.

Specified by:
getAbsoluteCapacity in interface CSQueue
Returns:
capacity of the parent of the queue as a function of the cumulative capacity in the cluster

getMaximumCapacity

public float getMaximumCapacity()
Description copied from interface: CSQueue
Get the configured maximum-capacity of the queue.

Specified by:
getMaximumCapacity in interface CSQueue
Returns:
the configured maximum-capacity of the queue

getAbsoluteMaximumCapacity

public float getAbsoluteMaximumCapacity()
Description copied from interface: CSQueue
Get maximum-capacity of the queue as a funciton of the cumulative capacity of the cluster.

Specified by:
getAbsoluteMaximumCapacity in interface CSQueue
Returns:
maximum-capacity of the queue as a funciton of the cumulative capacity of the cluster

getAbsoluteUsedCapacity

public float getAbsoluteUsedCapacity()
Description copied from interface: CSQueue
Get the current absolute used capacity of the queue relative to the entire cluster.

Specified by:
getAbsoluteUsedCapacity in interface CSQueue
Returns:
queue absolute used capacity

getParent

public CSQueue getParent()
Description copied from interface: CSQueue
Get the parent Queue.

Specified by:
getParent in interface CSQueue
Returns:
the parent queue

setParent

public void setParent(CSQueue newParentQueue)
Description copied from interface: CSQueue
Set the parent Queue.

Specified by:
setParent in interface CSQueue
Parameters:
newParentQueue - new parent queue

getQueueName

public String getQueueName()
Description copied from interface: CSQueue
Get the queue name.

Specified by:
getQueueName in interface CSQueue
Specified by:
getQueueName in interface Queue
Returns:
the queue name

getQueuePath

public String getQueuePath()
Description copied from interface: CSQueue
Get the full name of the queue, including the heirarchy.

Specified by:
getQueuePath in interface CSQueue
Returns:
the full name of the queue

getMinimumAllocation

@InterfaceAudience.Private
public org.apache.hadoop.yarn.api.records.Resource getMinimumAllocation()
Used only by tests.


getMaximumAllocation

@InterfaceAudience.Private
public org.apache.hadoop.yarn.api.records.Resource getMaximumAllocation()
Used only by tests.


getMinimumAllocationFactor

@InterfaceAudience.Private
public float getMinimumAllocationFactor()
Used only by tests.


getMaxAMResourcePerQueuePercent

@InterfaceAudience.Private
public float getMaxAMResourcePerQueuePercent()
Used only by tests.


getMaxApplications

public int getMaxApplications()

getMaxApplicationsPerUser

public int getMaxApplicationsPerUser()

getMaximumActiveApplications

public int getMaximumActiveApplications()

getMaximumActiveApplicationsPerUser

public int getMaximumActiveApplicationsPerUser()

getActiveUsersManager

public ActiveUsersManager getActiveUsersManager()
Description copied from interface: CSQueue
Get the ActiveUsersManager for the queue.

Specified by:
getActiveUsersManager in interface CSQueue
Returns:
the ActiveUsersManager for the queue

getUsedCapacity

public float getUsedCapacity()
Description copied from interface: CSQueue
Get the current used capacity of the queue and it's children (if any).

Specified by:
getUsedCapacity in interface CSQueue
Returns:
queue used capacity

getUsedResources

public org.apache.hadoop.yarn.api.records.Resource getUsedResources()
Description copied from interface: CSQueue
Get the currently utilized resources in the cluster by the queue and children (if any).

Specified by:
getUsedResources in interface CSQueue
Returns:
used resources by the queue and it's children

getChildQueues

public List<CSQueue> getChildQueues()
Description copied from interface: CSQueue
Get child queues

Specified by:
getChildQueues in interface CSQueue
Returns:
child queues

setUsedCapacity

public void setUsedCapacity(float usedCapacity)
Description copied from interface: CSQueue
Set used capacity of the queue.

Specified by:
setUsedCapacity in interface CSQueue
Parameters:
usedCapacity - used capacity of the queue

setAbsoluteUsedCapacity

public void setAbsoluteUsedCapacity(float absUsedCapacity)
Description copied from interface: CSQueue
Set absolute used capacity of the queue.

Specified by:
setAbsoluteUsedCapacity in interface CSQueue
Parameters:
absUsedCapacity - absolute used capacity of the queue

getNumApplications

public int getNumApplications()
Description copied from interface: CSQueue
Get the number of applications in the queue.

Specified by:
getNumApplications in interface CSQueue
Returns:
number of applications

getNumPendingApplications

public int getNumPendingApplications()

getNumActiveApplications

public int getNumActiveApplications()

getNumApplications

@InterfaceAudience.Private
public int getNumApplications(String user)

getNumPendingApplications

@InterfaceAudience.Private
public int getNumPendingApplications(String user)

getNumActiveApplications

@InterfaceAudience.Private
public int getNumActiveApplications(String user)

getNumContainers

public int getNumContainers()

getState

public org.apache.hadoop.yarn.api.records.QueueState getState()
Description copied from interface: CSQueue
Get the current run-state of the queue

Specified by:
getState in interface CSQueue
Returns:
current run-state

getUserLimit

@InterfaceAudience.Private
public int getUserLimit()

getUserLimitFactor

@InterfaceAudience.Private
public float getUserLimitFactor()

getQueueInfo

public org.apache.hadoop.yarn.api.records.QueueInfo getQueueInfo(boolean includeChildQueues,
                                                                 boolean recursive)
Description copied from interface: Queue
Get queue information

Specified by:
getQueueInfo in interface Queue
Parameters:
includeChildQueues - include child queues?
recursive - recursively get child queue information?
Returns:
queue information

getQueueUserAclInfo

public List<org.apache.hadoop.yarn.api.records.QueueUserACLInfo> getQueueUserAclInfo(org.apache.hadoop.security.UserGroupInformation user)
Description copied from interface: Queue
Get queue ACLs for given user.

Specified by:
getQueueUserAclInfo in interface Queue
Parameters:
user - username
Returns:
queue ACLs for user

getNodeLocalityDelay

@InterfaceAudience.Private
public int getNodeLocalityDelay()

toString

public String toString()
Overrides:
toString in class Object

getUsers

public ArrayList<UserInfo> getUsers()
Returns:
an ArrayList of UserInfo objects who are active in this queue

reinitialize

public void reinitialize(CSQueue newlyParsedQueue,
                         org.apache.hadoop.yarn.api.records.Resource clusterResource)
                  throws IOException
Description copied from interface: CSQueue
Reinitialize the queue.

Specified by:
reinitialize in interface CSQueue
Parameters:
newlyParsedQueue - new queue to re-initalize from
clusterResource - resources in the cluster
Throws:
IOException

hasAccess

public boolean hasAccess(org.apache.hadoop.yarn.api.records.QueueACL acl,
                         org.apache.hadoop.security.UserGroupInformation user)
Description copied from interface: CSQueue
Check if the user has permission to perform the operation

Specified by:
hasAccess in interface CSQueue
Specified by:
hasAccess in interface Queue
Parameters:
acl - ACL
user - user
Returns:
true if the user has the permission, false otherwise

submitApplication

public void submitApplication(FiCaSchedulerApp application,
                              String userName,
                              String queue)
                       throws org.apache.hadoop.security.AccessControlException
Description copied from interface: CSQueue
Submit a new application to the queue.

Specified by:
submitApplication in interface CSQueue
Parameters:
application - application being submitted
userName - user who submitted the application
queue - queue to which the application is submitted
Throws:
org.apache.hadoop.security.AccessControlException

finishApplication

public void finishApplication(FiCaSchedulerApp application,
                              String queue)
Description copied from interface: CSQueue
An application submitted to this queue has finished.

Specified by:
finishApplication in interface CSQueue
queue - application queue

removeApplication

public void removeApplication(FiCaSchedulerApp application,
                              org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.LeafQueue.User user)

assignContainers

public CSAssignment assignContainers(org.apache.hadoop.yarn.api.records.Resource clusterResource,
                                     FiCaSchedulerNode node)
Description copied from interface: CSQueue
Assign containers to applications in the queue or it's children (if any).

Specified by:
assignContainers in interface CSQueue
Parameters:
clusterResource - the resource of the cluster.
node - node on which resources are available
Returns:
the assignment

completedContainer

public void completedContainer(org.apache.hadoop.yarn.api.records.Resource clusterResource,
                               FiCaSchedulerApp application,
                               FiCaSchedulerNode node,
                               RMContainer rmContainer,
                               org.apache.hadoop.yarn.api.records.ContainerStatus containerStatus,
                               RMContainerEventType event,
                               CSQueue childQueue)
Description copied from interface: CSQueue
A container assigned to the queue has completed.

Specified by:
completedContainer in interface CSQueue
Parameters:
clusterResource - the resource of the cluster
application - application to which the container was assigned
node - node on which the container completed
rmContainer - completed container, null if it was just a reservation
containerStatus - ContainerStatus for the completed container
event - event to be sent to the container
childQueue - CSQueue to reinsert in childQueues

updateClusterResource

public void updateClusterResource(org.apache.hadoop.yarn.api.records.Resource clusterResource)
Description copied from interface: CSQueue
Update the cluster resource for queues as we add/remove nodes

Specified by:
updateClusterResource in interface CSQueue
Parameters:
clusterResource - the current cluster resource

getMetrics

public QueueMetrics getMetrics()
Description copied from interface: Queue
Get the queue metrics

Specified by:
getMetrics in interface Queue
Returns:
the queue metrics

recoverContainer

public void recoverContainer(org.apache.hadoop.yarn.api.records.Resource clusterResource,
                             FiCaSchedulerApp application,
                             org.apache.hadoop.yarn.api.records.Container container)
Description copied from interface: CSQueue
Recover the state of the queue

Specified by:
recoverContainer in interface CSQueue
Parameters:
clusterResource - the resource of the cluster
application - the application for which the container was allocated
container - the container that was recovered.

getApplications

public Set<FiCaSchedulerApp> getApplications()
Obtain (read-only) collection of active applications.


getTotalResourcePending

public org.apache.hadoop.yarn.api.records.Resource getTotalResourcePending()


Copyright © 2014 Apache Software Foundation. All Rights Reserved.