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

java.lang.Object
  extended by org.apache.hadoop.yarn.server.resourcemanager.scheduler.SchedulerApplication
Direct Known Subclasses:
FiCaSchedulerApp, FSSchedulerApp

@InterfaceAudience.Private
@InterfaceStability.Unstable
public abstract class SchedulerApplication
extends Object

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


Field Summary
protected  AppSchedulingInfo appSchedulingInfo
           
protected  org.apache.hadoop.yarn.api.records.Resource currentConsumption
           
protected  org.apache.hadoop.yarn.api.records.Resource currentReservation
           
protected  boolean isStopped
           
protected  Map<org.apache.hadoop.yarn.api.records.Priority,Long> lastScheduledContainer
           
protected  Map<org.apache.hadoop.yarn.api.records.ContainerId,RMContainer> liveContainers
           
protected  List<RMContainer> newlyAllocatedContainers
           
protected  Queue queue
           
protected  Map<org.apache.hadoop.yarn.api.records.Priority,Map<org.apache.hadoop.yarn.api.records.NodeId,RMContainer>> reservedContainers
           
protected  RMContext rmContext
           
 
Constructor Summary
SchedulerApplication(org.apache.hadoop.yarn.api.records.ApplicationAttemptId applicationAttemptId, String user, Queue queue, ActiveUsersManager activeUsersManager, RMContext rmContext)
           
 
Method Summary
protected  void addReReservation(org.apache.hadoop.yarn.api.records.Priority priority)
           
 void addSchedulingOpportunity(org.apache.hadoop.yarn.api.records.Priority priority)
           
 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()
          Get ApplicationAttemptId of the application master.
 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 live containers of the application.
 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 resourceName)
           
 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 isBlacklisted(String resourceName)
           
 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?
 boolean isStopped()
           
 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)
           
protected  void resetReReservations(org.apache.hadoop.yarn.api.records.Priority priority)
           
 void resetSchedulingOpportunities(org.apache.hadoop.yarn.api.records.Priority priority)
          Should be called when an application has successfully scheduled a container, or when the scheduling locality threshold is relaxed.
 void resetSchedulingOpportunities(org.apache.hadoop.yarn.api.records.Priority priority, long currentTimeMs)
           
 void setHeadroom(org.apache.hadoop.yarn.api.records.Resource globalLimit)
           
 void showRequests()
           
 void stop(RMAppAttemptState rmAppAttemptFinalState)
           
 void subtractSchedulingOpportunity(org.apache.hadoop.yarn.api.records.Priority priority)
           
 void updateBlacklist(List<String> blacklistAdditions, List<String> blacklistRemovals)
           
 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
 

Field Detail

appSchedulingInfo

protected final AppSchedulingInfo appSchedulingInfo

liveContainers

protected final Map<org.apache.hadoop.yarn.api.records.ContainerId,RMContainer> liveContainers

reservedContainers

protected final Map<org.apache.hadoop.yarn.api.records.Priority,Map<org.apache.hadoop.yarn.api.records.NodeId,RMContainer>> reservedContainers

currentReservation

protected final org.apache.hadoop.yarn.api.records.Resource currentReservation

currentConsumption

protected final org.apache.hadoop.yarn.api.records.Resource currentConsumption

newlyAllocatedContainers

protected List<RMContainer> newlyAllocatedContainers

lastScheduledContainer

protected Map<org.apache.hadoop.yarn.api.records.Priority,Long> lastScheduledContainer

queue

protected final Queue queue

isStopped

protected boolean isStopped

rmContext

protected final RMContext rmContext
Constructor Detail

SchedulerApplication

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

getLiveContainers

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

Returns:
live containers of the application

isPending

public boolean isPending()
Is this application pending?

Returns:
true if it is else false.

getApplicationAttemptId

public org.apache.hadoop.yarn.api.records.ApplicationAttemptId getApplicationAttemptId()
Get ApplicationAttemptId of the application master.

Returns:
ApplicationAttemptId of the application master

getApplicationId

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

getUser

public String getUser()

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 resourceName)

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)

getQueueName

public String getQueueName()

getRMContainer

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

resetReReservations

protected void resetReReservations(org.apache.hadoop.yarn.api.records.Priority priority)

addReReservation

protected void addReReservation(org.apache.hadoop.yarn.api.records.Priority priority)

getReReservations

public int getReReservations(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

getQueue

public Queue getQueue()

updateResourceRequests

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

stop

public void stop(RMAppAttemptState rmAppAttemptFinalState)

isStopped

public boolean isStopped()

getReservedContainers

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

Returns:
All of the reserved containers.

reserve

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

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

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

getNumReservedContainers

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

containerLaunchedOnNode

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

showRequests

public void showRequests()

getCurrentConsumption

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

pullNewlyAllocatedContainers

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

updateBlacklist

public void updateBlacklist(List<String> blacklistAdditions,
                            List<String> blacklistRemovals)

isBlacklisted

public boolean isBlacklisted(String resourceName)

addSchedulingOpportunity

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

subtractSchedulingOpportunity

public void subtractSchedulingOpportunity(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.


resetSchedulingOpportunities

public void resetSchedulingOpportunities(org.apache.hadoop.yarn.api.records.Priority priority)
Should be called when an application has successfully scheduled a container, or when the scheduling locality threshold is relaxed. Reset various internal counters which affect delay scheduling

Parameters:
priority - The priority of the container scheduled.

resetSchedulingOpportunities

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


Copyright © 2014 Apache Software Foundation. All Rights Reserved.