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

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

@InterfaceAudience.Private
@InterfaceStability.Unstable
public class SchedulerApplicationAttempt
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.


Nested Class Summary
static class SchedulerApplicationAttempt.ContainersAndNMTokensAllocation
           
 
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  long lastMemoryAggregateAllocationUpdateTime
           
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
SchedulerApplicationAttempt(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.Resource getAMResource()
           
 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.
 Map<org.apache.hadoop.yarn.api.records.Priority,Long> getLastScheduledContainer()
           
 Collection<RMContainer> getLiveContainers()
          Get the live containers of the application.
 Map<org.apache.hadoop.yarn.api.records.ContainerId,RMContainer> getLiveContainersMap()
           
 long getNewContainerId()
           
 int getNumReservedContainers(org.apache.hadoop.yarn.api.records.Priority priority)
           
 Set<org.apache.hadoop.yarn.api.records.ContainerId> getPendingRelease()
           
 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.Resource getResourceLimit()
           
 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)
           
 org.apache.hadoop.yarn.api.records.ApplicationResourceUsageReport getResourceUsageReport()
           
 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)
           
 boolean getUnmanagedAM()
           
 String getUser()
           
 boolean isAmRunning()
           
 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()
           
 void move(Queue newQueue)
           
 SchedulerApplicationAttempt.ContainersAndNMTokensAllocation pullNewlyAllocatedContainersAndNMTokens()
           
 void recoverContainer(RMContainer rmContainer)
           
 void recoverResourceRequests(List<org.apache.hadoop.yarn.api.records.ResourceRequest> requests)
           
 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 setAMResource(org.apache.hadoop.yarn.api.records.Resource amResource)
           
 void setAmRunning(boolean bool)
           
 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 transferStateFromPreviousAttempt(SchedulerApplicationAttempt appAttempt)
           
 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

lastMemoryAggregateAllocationUpdateTime

protected long lastMemoryAggregateAllocationUpdateTime

appSchedulingInfo

protected final AppSchedulingInfo appSchedulingInfo

liveContainers

protected 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 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 Queue queue

isStopped

protected boolean isStopped

rmContext

protected final RMContext rmContext
Constructor Detail

SchedulerApplicationAttempt

public SchedulerApplicationAttempt(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)

getPendingRelease

public Set<org.apache.hadoop.yarn.api.records.ContainerId> getPendingRelease()

getNewContainerId

public long 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()

getAMResource

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

setAMResource

public void setAMResource(org.apache.hadoop.yarn.api.records.Resource amResource)

isAmRunning

public boolean isAmRunning()

setAmRunning

public void setAmRunning(boolean bool)

getUnmanagedAM

public boolean getUnmanagedAM()

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)

recoverResourceRequests

public void recoverResourceRequests(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()

pullNewlyAllocatedContainersAndNMTokens

public SchedulerApplicationAttempt.ContainersAndNMTokensAllocation pullNewlyAllocatedContainersAndNMTokens()

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)

getResourceUsageReport

public org.apache.hadoop.yarn.api.records.ApplicationResourceUsageReport getResourceUsageReport()

getLiveContainersMap

public Map<org.apache.hadoop.yarn.api.records.ContainerId,RMContainer> getLiveContainersMap()

getResourceLimit

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

getLastScheduledContainer

public Map<org.apache.hadoop.yarn.api.records.Priority,Long> getLastScheduledContainer()

transferStateFromPreviousAttempt

public void transferStateFromPreviousAttempt(SchedulerApplicationAttempt appAttempt)

move

public void move(Queue newQueue)

recoverContainer

public void recoverContainer(RMContainer rmContainer)


Copyright © 2014 Apache Software Foundation. All Rights Reserved.