org.apache.hadoop.yarn.server.resourcemanager.scheduler
Class SchedulerApp

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

public class SchedulerApp
extends Object

Represents an Application from the viewpoint of the scheduler. Each running Application in the RM corresponds to one instance of this class.


Constructor Summary
SchedulerApp(org.apache.hadoop.yarn.api.records.ApplicationAttemptId applicationAttemptId, String user, Queue queue, ActiveUsersManager activeUsersManager, RMContext rmContext, ApplicationsStore.ApplicationStore store)
           
 
Method Summary
 void addSchedulingOpportunity(org.apache.hadoop.yarn.api.records.Priority priority)
           
 RMContainer allocate(NodeType type, SchedulerNode node, org.apache.hadoop.yarn.api.records.Priority priority, org.apache.hadoop.yarn.api.records.ResourceRequest request, org.apache.hadoop.yarn.api.records.Container container)
           
 void containerCompleted(RMContainer rmContainer, org.apache.hadoop.yarn.api.records.ContainerStatus containerStatus, RMContainerEventType event)
           
 void containerLaunchedOnNode(org.apache.hadoop.yarn.api.records.ContainerId containerId, org.apache.hadoop.yarn.api.records.NodeId nodeId)
           
 org.apache.hadoop.yarn.api.records.ApplicationAttemptId getApplicationAttemptId()
           
 org.apache.hadoop.yarn.api.records.ApplicationId getApplicationId()
           
 org.apache.hadoop.yarn.api.records.Resource getCurrentConsumption()
           
 org.apache.hadoop.yarn.api.records.Resource getCurrentReservation()
          Get total current reservations.
 org.apache.hadoop.yarn.api.records.Resource getHeadroom()
          Get available headroom in terms of resources for the application's user.
 Collection<RMContainer> getLiveContainers()
          Get the list of live containers
 float getLocalityWaitFactor(org.apache.hadoop.yarn.api.records.Priority priority, int clusterNodes)
           
 int getNewContainerId()
           
 int getNumReservedContainers(org.apache.hadoop.yarn.api.records.Priority priority)
           
 Collection<org.apache.hadoop.yarn.api.records.Priority> getPriorities()
           
 Queue getQueue()
           
 String getQueueName()
           
 int getReReservations(org.apache.hadoop.yarn.api.records.Priority priority)
           
 List<RMContainer> getReservedContainers()
          Get the list of reserved containers
 org.apache.hadoop.yarn.api.records.Resource getResource(org.apache.hadoop.yarn.api.records.Priority priority)
           
 org.apache.hadoop.yarn.api.records.ResourceRequest getResourceRequest(org.apache.hadoop.yarn.api.records.Priority priority, String nodeAddress)
           
 Map<String,org.apache.hadoop.yarn.api.records.ResourceRequest> getResourceRequests(org.apache.hadoop.yarn.api.records.Priority priority)
           
 RMContainer getRMContainer(org.apache.hadoop.yarn.api.records.ContainerId id)
           
 int getSchedulingOpportunities(org.apache.hadoop.yarn.api.records.Priority priority)
          Return the number of times the application has been given an opportunity to schedule a task at the given priority since the last time it successfully did so.
 int getTotalRequiredResources(org.apache.hadoop.yarn.api.records.Priority priority)
           
 String getUser()
           
 boolean isPending()
          Is this application pending?
 boolean isReserved(SchedulerNode node, org.apache.hadoop.yarn.api.records.Priority priority)
          Has the application reserved the given node at the given priority?
 List<org.apache.hadoop.yarn.api.records.Container> pullNewlyAllocatedContainers()
           
 RMContainer reserve(SchedulerNode node, org.apache.hadoop.yarn.api.records.Priority priority, RMContainer rmContainer, org.apache.hadoop.yarn.api.records.Container container)
           
 void resetSchedulingOpportunities(org.apache.hadoop.yarn.api.records.Priority priority)
           
 void setHeadroom(org.apache.hadoop.yarn.api.records.Resource globalLimit)
           
 void showRequests()
           
 void stop(RMAppAttemptState rmAppAttemptFinalState)
           
 void unreserve(SchedulerNode node, org.apache.hadoop.yarn.api.records.Priority priority)
           
 void updateResourceRequests(List<org.apache.hadoop.yarn.api.records.ResourceRequest> requests)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SchedulerApp

public SchedulerApp(org.apache.hadoop.yarn.api.records.ApplicationAttemptId applicationAttemptId,
                    String user,
                    Queue queue,
                    ActiveUsersManager activeUsersManager,
                    RMContext rmContext,
                    ApplicationsStore.ApplicationStore store)
Method Detail

getApplicationId

public org.apache.hadoop.yarn.api.records.ApplicationId getApplicationId()

getApplicationAttemptId

public org.apache.hadoop.yarn.api.records.ApplicationAttemptId getApplicationAttemptId()

getUser

public String getUser()

updateResourceRequests

public void updateResourceRequests(List<org.apache.hadoop.yarn.api.records.ResourceRequest> requests)

getResourceRequests

public Map<String,org.apache.hadoop.yarn.api.records.ResourceRequest> getResourceRequests(org.apache.hadoop.yarn.api.records.Priority priority)

getNewContainerId

public int getNewContainerId()

getPriorities

public Collection<org.apache.hadoop.yarn.api.records.Priority> getPriorities()

getResourceRequest

public org.apache.hadoop.yarn.api.records.ResourceRequest getResourceRequest(org.apache.hadoop.yarn.api.records.Priority priority,
                                                                             String nodeAddress)

getTotalRequiredResources

public int getTotalRequiredResources(org.apache.hadoop.yarn.api.records.Priority priority)

getResource

public org.apache.hadoop.yarn.api.records.Resource getResource(org.apache.hadoop.yarn.api.records.Priority priority)

isPending

public boolean isPending()
Is this application pending?

Returns:
true if it is else false.

getQueueName

public String getQueueName()

getLiveContainers

public Collection<RMContainer> getLiveContainers()
Get the list of live containers

Returns:
All of the live containers

stop

public void stop(RMAppAttemptState rmAppAttemptFinalState)

containerLaunchedOnNode

public void containerLaunchedOnNode(org.apache.hadoop.yarn.api.records.ContainerId containerId,
                                    org.apache.hadoop.yarn.api.records.NodeId nodeId)

containerCompleted

public void containerCompleted(RMContainer rmContainer,
                               org.apache.hadoop.yarn.api.records.ContainerStatus containerStatus,
                               RMContainerEventType event)

allocate

public RMContainer allocate(NodeType type,
                            SchedulerNode node,
                            org.apache.hadoop.yarn.api.records.Priority priority,
                            org.apache.hadoop.yarn.api.records.ResourceRequest request,
                            org.apache.hadoop.yarn.api.records.Container container)

pullNewlyAllocatedContainers

public List<org.apache.hadoop.yarn.api.records.Container> pullNewlyAllocatedContainers()

getCurrentConsumption

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

showRequests

public void showRequests()

getRMContainer

public RMContainer getRMContainer(org.apache.hadoop.yarn.api.records.ContainerId id)

resetSchedulingOpportunities

public void resetSchedulingOpportunities(org.apache.hadoop.yarn.api.records.Priority priority)

addSchedulingOpportunity

public void addSchedulingOpportunity(org.apache.hadoop.yarn.api.records.Priority priority)

getSchedulingOpportunities

public int getSchedulingOpportunities(org.apache.hadoop.yarn.api.records.Priority priority)
Return the number of times the application has been given an opportunity to schedule a task at the given priority since the last time it successfully did so.


getReReservations

public int getReReservations(org.apache.hadoop.yarn.api.records.Priority priority)

getNumReservedContainers

public int getNumReservedContainers(org.apache.hadoop.yarn.api.records.Priority priority)

getCurrentReservation

@InterfaceStability.Stable
@InterfaceAudience.Private
public org.apache.hadoop.yarn.api.records.Resource getCurrentReservation()
Get total current reservations. Used only by unit tests

Returns:
total current reservations

reserve

public RMContainer reserve(SchedulerNode node,
                           org.apache.hadoop.yarn.api.records.Priority priority,
                           RMContainer rmContainer,
                           org.apache.hadoop.yarn.api.records.Container container)

unreserve

public void unreserve(SchedulerNode node,
                      org.apache.hadoop.yarn.api.records.Priority priority)

isReserved

public boolean isReserved(SchedulerNode node,
                          org.apache.hadoop.yarn.api.records.Priority priority)
Has the application reserved the given node at the given priority?

Parameters:
node - node to be checked
priority - priority of reserved container
Returns:
true is reserved, false if not

getLocalityWaitFactor

public float getLocalityWaitFactor(org.apache.hadoop.yarn.api.records.Priority priority,
                                   int clusterNodes)

getReservedContainers

public List<RMContainer> getReservedContainers()
Get the list of reserved containers

Returns:
All of the reserved containers.

setHeadroom

public void setHeadroom(org.apache.hadoop.yarn.api.records.Resource globalLimit)

getHeadroom

public org.apache.hadoop.yarn.api.records.Resource getHeadroom()
Get available headroom in terms of resources for the application's user.

Returns:
available resource headroom

getQueue

public Queue getQueue()


Copyright © 2012 Apache Software Foundation. All Rights Reserved.