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

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

@InterfaceAudience.Private
@InterfaceStability.Unstable
public class LeafQueue
extends AbstractCSQueue


Nested Class Summary
static class LeafQueue.User
           
 
Field Summary
protected  int maxApplications
           
protected  int maxApplicationsPerUser
           
 
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, boolean needToUnreserve)
          Assign containers to applications in the queue or it's children (if any).
protected  boolean assignToUser(org.apache.hadoop.yarn.api.records.Resource clusterResource, String userName, org.apache.hadoop.yarn.api.records.Resource limit, FiCaSchedulerApp application, boolean checkReservations, Set<String> requestLabels)
           
 void attachContainer(org.apache.hadoop.yarn.api.records.Resource clusterResource, FiCaSchedulerApp application, RMContainer rmContainer)
          Attach a container to this queue
protected  boolean checkLimitsToReserve(org.apache.hadoop.yarn.api.records.Resource clusterResource, FiCaSchedulerApp application, org.apache.hadoop.yarn.api.records.Resource capability, boolean needToUnreserve)
           
 void collectSchedulerApplications(Collection<org.apache.hadoop.yarn.api.records.ApplicationAttemptId> apps)
          Adds all applications in the queue and its subqueues to the given collection.
 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, boolean sortQueues)
          A container assigned to the queue has completed.
 void detachContainer(org.apache.hadoop.yarn.api.records.Resource clusterResource, FiCaSchedulerApp application, RMContainer rmContainer)
          Detach a container from this queue
protected  boolean findNodeToUnreserve(org.apache.hadoop.yarn.api.records.Resource clusterResource, FiCaSchedulerNode node, FiCaSchedulerApp application, org.apache.hadoop.yarn.api.records.Priority priority, org.apache.hadoop.yarn.api.records.Resource capability)
           
 void finishApplication(org.apache.hadoop.yarn.api.records.ApplicationId application, String user)
          An application submitted to this queue has finished.
 void finishApplicationAttempt(FiCaSchedulerApp application, String queue)
          An application attempt submitted to this queue has finished.
 float getAbsActualCapacity()
          Get actual capacity of the queue, this may be different from configured capacity when mis-config take place, like add labels to the cluster
 ActiveUsersManager getActiveUsersManager()
          Get the ActiveUsersManager for the queue.
 Set<FiCaSchedulerApp> getApplications()
          Obtain (read-only) collection of active applications.
protected  float getCapacityFromConf()
           
 List<CSQueue> getChildQueues()
          Get child queues
protected  org.apache.hadoop.yarn.api.records.Resource getHeadroom(LeafQueue.User user, org.apache.hadoop.yarn.api.records.Resource queueMaxCap, org.apache.hadoop.yarn.api.records.Resource clusterResource, FiCaSchedulerApp application, org.apache.hadoop.yarn.api.records.Resource required)
           
 float getMaxAMResourcePerQueuePercent()
          Used only by tests.
 int getMaxApplications()
           
 int getMaxApplicationsPerUser()
           
 int getMaximumActiveApplications()
           
 int getMaximumActiveApplicationsPerUser()
           
 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)
           
 org.apache.hadoop.yarn.api.records.QueueInfo getQueueInfo(boolean includeChildQueues, boolean recursive)
          Get queue information
 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()
           
 LeafQueue.User getUser(String userName)
           
 int getUserLimit()
           
 float getUserLimitFactor()
           
 ArrayList<UserInfo> getUsers()
           
 void recoverContainer(org.apache.hadoop.yarn.api.records.Resource clusterResource, SchedulerApplicationAttempt attempt, RMContainer rmContainer)
          Recover the state of the queue for a given container.
 void reinitialize(CSQueue newlyParsedQueue, org.apache.hadoop.yarn.api.records.Resource clusterResource)
          Reinitialize the queue.
 void removeApplicationAttempt(FiCaSchedulerApp application, LeafQueue.User user)
           
 void setAbsoluteCapacity(float absoluteCapacity)
           
 void setCapacity(float capacity)
           
 void setMaxApplications(int maxApplications)
           
 void setNodeLabelManager(RMNodeLabelsManager mgr)
           
protected  void setupQueueConfigs(org.apache.hadoop.yarn.api.records.Resource clusterResource, float capacity, float absoluteCapacity, float maximumCapacity, float absoluteMaxCapacity, int userLimit, float userLimitFactor, int maxApplications, float maxAMResourcePerQueuePercent, int maxApplicationsPerUser, int maxActiveApplications, int maxActiveApplicationsPerUser, org.apache.hadoop.yarn.api.records.QueueState state, Map<org.apache.hadoop.yarn.api.records.QueueACL,org.apache.hadoop.security.authorize.AccessControlList> acls, int nodeLocalityDelay, Set<String> labels, String defaultLabelExpression, Map<String,Float> capacitieByLabel, Map<String,Float> maximumCapacitiesByLabel, boolean revervationContinueLooking)
           
 void submitApplication(org.apache.hadoop.yarn.api.records.ApplicationId applicationId, String userName, String queue)
          Submit a new application to the queue.
 void submitApplicationAttempt(FiCaSchedulerApp application, String userName)
          Submit an application attempt 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 org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.AbstractCSQueue
getAbsoluteCapacity, getAbsoluteCapacityByNodeLabel, getAbsoluteMaximumCapacity, getAbsoluteMaximumCapacityByNodeLabel, getAbsoluteUsedCapacity, getAccessibleNodeLabels, getACLs, getCapacity, getCapacityByNodeLabel, getDefaultNodeLabelExpression, getMaximumAllocation, getMaximumCapacity, getMetrics, getMinimumAllocation, getParent, getQueueName, getReservationContinueLooking, getUsedCapacity, getUsedResources, hasAccess, releaseResource, setAbsoluteUsedCapacity, setParent, setUsedCapacity
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

maxApplications

protected int maxApplications

maxApplicationsPerUser

protected int maxApplicationsPerUser
Constructor Detail

LeafQueue

public LeafQueue(CapacitySchedulerContext cs,
                 String queueName,
                 CSQueue parent,
                 CSQueue old)
          throws IOException
Throws:
IOException
Method Detail

getCapacityFromConf

protected float getCapacityFromConf()

setupQueueConfigs

protected void setupQueueConfigs(org.apache.hadoop.yarn.api.records.Resource clusterResource,
                                 float capacity,
                                 float absoluteCapacity,
                                 float maximumCapacity,
                                 float absoluteMaxCapacity,
                                 int userLimit,
                                 float userLimitFactor,
                                 int maxApplications,
                                 float maxAMResourcePerQueuePercent,
                                 int maxApplicationsPerUser,
                                 int maxActiveApplications,
                                 int maxActiveApplicationsPerUser,
                                 org.apache.hadoop.yarn.api.records.QueueState state,
                                 Map<org.apache.hadoop.yarn.api.records.QueueACL,org.apache.hadoop.security.authorize.AccessControlList> acls,
                                 int nodeLocalityDelay,
                                 Set<String> labels,
                                 String defaultLabelExpression,
                                 Map<String,Float> capacitieByLabel,
                                 Map<String,Float> maximumCapacitiesByLabel,
                                 boolean revervationContinueLooking)
                          throws IOException
Throws:
IOException

getQueuePath

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

Returns:
the full name of the queue

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.

Returns:
the ActiveUsersManager for the queue

getChildQueues

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

Returns:
child queues

getNumApplications

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

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()
Overrides:
getNumContainers in class AbstractCSQueue

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
Overrides:
getState in class AbstractCSQueue
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

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.

Parameters:
user - username
Returns:
queue ACLs for user

getNodeLocalityDelay

@InterfaceAudience.Private
public int getNodeLocalityDelay()

toString

public String toString()
Overrides:
toString in class Object

setNodeLabelManager

public void setNodeLabelManager(RMNodeLabelsManager mgr)

getUser

public LeafQueue.User getUser(String userName)

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.

Parameters:
newlyParsedQueue - new queue to re-initalize from
clusterResource - resources in the cluster
Throws:
IOException

submitApplicationAttempt

public void submitApplicationAttempt(FiCaSchedulerApp application,
                                     String userName)
Description copied from interface: CSQueue
Submit an application attempt to the queue.


submitApplication

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

Parameters:
applicationId - the applicationId of the 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(org.apache.hadoop.yarn.api.records.ApplicationId application,
                              String user)
Description copied from interface: CSQueue
An application submitted to this queue has finished.

user - user who submitted the application

finishApplicationAttempt

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


removeApplicationAttempt

public void removeApplicationAttempt(FiCaSchedulerApp application,
                                     LeafQueue.User user)

assignContainers

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

Parameters:
clusterResource - the resource of the cluster.
node - node on which resources are available
needToUnreserve - assign container only if it can unreserve one first
Returns:
the assignment

getHeadroom

protected org.apache.hadoop.yarn.api.records.Resource getHeadroom(LeafQueue.User user,
                                                                  org.apache.hadoop.yarn.api.records.Resource queueMaxCap,
                                                                  org.apache.hadoop.yarn.api.records.Resource clusterResource,
                                                                  FiCaSchedulerApp application,
                                                                  org.apache.hadoop.yarn.api.records.Resource required)

assignToUser

@InterfaceAudience.Private
protected boolean assignToUser(org.apache.hadoop.yarn.api.records.Resource clusterResource,
                                                         String userName,
                                                         org.apache.hadoop.yarn.api.records.Resource limit,
                                                         FiCaSchedulerApp application,
                                                         boolean checkReservations,
                                                         Set<String> requestLabels)

findNodeToUnreserve

@InterfaceAudience.Private
protected boolean findNodeToUnreserve(org.apache.hadoop.yarn.api.records.Resource clusterResource,
                                                                FiCaSchedulerNode node,
                                                                FiCaSchedulerApp application,
                                                                org.apache.hadoop.yarn.api.records.Priority priority,
                                                                org.apache.hadoop.yarn.api.records.Resource capability)

checkLimitsToReserve

@InterfaceAudience.Private
protected boolean checkLimitsToReserve(org.apache.hadoop.yarn.api.records.Resource clusterResource,
                                                                 FiCaSchedulerApp application,
                                                                 org.apache.hadoop.yarn.api.records.Resource capability,
                                                                 boolean needToUnreserve)

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,
                               boolean sortQueues)
Description copied from interface: CSQueue
A container assigned to the queue has completed.

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
sortQueues - indicates whether it should re-sort the queues

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

Parameters:
clusterResource - the current cluster resource

recoverContainer

public void recoverContainer(org.apache.hadoop.yarn.api.records.Resource clusterResource,
                             SchedulerApplicationAttempt attempt,
                             RMContainer rmContainer)
Description copied from interface: Queue
Recover the state of the queue for a given container.

Parameters:
clusterResource - the resource of the cluster
attempt - the application for which the container was allocated
rmContainer - 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()

collectSchedulerApplications

public void collectSchedulerApplications(Collection<org.apache.hadoop.yarn.api.records.ApplicationAttemptId> apps)
Description copied from interface: CSQueue
Adds all applications in the queue and its subqueues to the given collection.

Parameters:
apps - the collection to add the applications to

attachContainer

public void attachContainer(org.apache.hadoop.yarn.api.records.Resource clusterResource,
                            FiCaSchedulerApp application,
                            RMContainer rmContainer)
Description copied from interface: CSQueue
Attach a container to this queue

Parameters:
clusterResource - the current cluster resource
application - application to which the container was assigned
rmContainer - the container to attach

detachContainer

public void detachContainer(org.apache.hadoop.yarn.api.records.Resource clusterResource,
                            FiCaSchedulerApp application,
                            RMContainer rmContainer)
Description copied from interface: CSQueue
Detach a container from this queue

Parameters:
clusterResource - the current cluster resource
application - application to which the container was assigned
rmContainer - the container to detach

getAbsActualCapacity

public float getAbsActualCapacity()
Description copied from interface: CSQueue
Get actual capacity of the queue, this may be different from configured capacity when mis-config take place, like add labels to the cluster

Specified by:
getAbsActualCapacity in interface CSQueue
Overrides:
getAbsActualCapacity in class AbstractCSQueue
Returns:
actual queue capacity

setCapacity

public void setCapacity(float capacity)

setAbsoluteCapacity

public void setAbsoluteCapacity(float absoluteCapacity)

setMaxApplications

public void setMaxApplications(int maxApplications)


Copyright © 2014 Apache Software Foundation. All Rights Reserved.