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

java.lang.Object
  extended by org.apache.hadoop.yarn.server.resourcemanager.scheduler.SchedulerNode
Direct Known Subclasses:
FiCaSchedulerNode, FSSchedulerNode

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

Represents a YARN Cluster Node from the viewpoint of the scheduler.


Constructor Summary
SchedulerNode(RMNode node, boolean usePortForNodeName)
           
 
Method Summary
 void allocateContainer(RMContainer rmContainer)
          The Scheduler has allocated containers on this node to the given application.
 org.apache.hadoop.yarn.api.records.Resource getAvailableResource()
          Get available resources on the node.
 String getHttpAddress()
           
 org.apache.hadoop.yarn.api.records.NodeId getNodeID()
          Get the ID of the node which contains both its hostname and port.
 String getNodeName()
          Get the name of the node for scheduling matching decisions.
 int getNumContainers()
          Get number of active containers on the node.
 String getRackName()
          Get rackname.
 RMContainer getReservedContainer()
           
 RMNode getRMNode()
           
 List<RMContainer> getRunningContainers()
           
 org.apache.hadoop.yarn.api.records.Resource getTotalResource()
          Get total resources on the node.
 org.apache.hadoop.yarn.api.records.Resource getUsedResource()
          Get used resources on the node.
 boolean isValidContainer(org.apache.hadoop.yarn.api.records.ContainerId containerId)
           
 void recoverContainer(RMContainer rmContainer)
           
 void releaseContainer(org.apache.hadoop.yarn.api.records.Container container)
          Release an allocated container on this node.
abstract  void reserveResource(SchedulerApplicationAttempt attempt, org.apache.hadoop.yarn.api.records.Priority priority, RMContainer container)
          Reserve container for the attempt on this node.
protected  void setReservedContainer(RMContainer reservedContainer)
           
 void setTotalResource(org.apache.hadoop.yarn.api.records.Resource resource)
          Set total resources on the node.
 String toString()
           
abstract  void unreserveResource(SchedulerApplicationAttempt attempt)
          Unreserve resources on this node.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SchedulerNode

public SchedulerNode(RMNode node,
                     boolean usePortForNodeName)
Method Detail

getRMNode

public RMNode getRMNode()

setTotalResource

public void setTotalResource(org.apache.hadoop.yarn.api.records.Resource resource)
Set total resources on the node.

Parameters:
resource - total resources on the node.

getNodeID

public org.apache.hadoop.yarn.api.records.NodeId getNodeID()
Get the ID of the node which contains both its hostname and port.

Returns:
the ID of the node

getHttpAddress

public String getHttpAddress()

getNodeName

public String getNodeName()
Get the name of the node for scheduling matching decisions.

Typically this is the 'hostname' reported by the node, but it could be configured to be 'hostname:port' reported by the node via the YarnConfiguration.RM_SCHEDULER_INCLUDE_PORT_IN_NODE_NAME constant. The main usecase of this is Yarn minicluster to be able to differentiate node manager instances by their port number.

Returns:
name of the node for scheduling matching decisions.

getRackName

public String getRackName()
Get rackname.

Returns:
rackname

allocateContainer

public void allocateContainer(RMContainer rmContainer)
The Scheduler has allocated containers on this node to the given application.

Parameters:
rmContainer - allocated container

getAvailableResource

public org.apache.hadoop.yarn.api.records.Resource getAvailableResource()
Get available resources on the node.

Returns:
available resources on the node

getUsedResource

public org.apache.hadoop.yarn.api.records.Resource getUsedResource()
Get used resources on the node.

Returns:
used resources on the node

getTotalResource

public org.apache.hadoop.yarn.api.records.Resource getTotalResource()
Get total resources on the node.

Returns:
total resources on the node.

isValidContainer

public boolean isValidContainer(org.apache.hadoop.yarn.api.records.ContainerId containerId)

releaseContainer

public void releaseContainer(org.apache.hadoop.yarn.api.records.Container container)
Release an allocated container on this node.

Parameters:
container - container to be released

reserveResource

public abstract void reserveResource(SchedulerApplicationAttempt attempt,
                                     org.apache.hadoop.yarn.api.records.Priority priority,
                                     RMContainer container)
Reserve container for the attempt on this node.


unreserveResource

public abstract void unreserveResource(SchedulerApplicationAttempt attempt)
Unreserve resources on this node.


toString

public String toString()
Overrides:
toString in class Object

getNumContainers

public int getNumContainers()
Get number of active containers on the node.

Returns:
number of active containers on the node

getRunningContainers

public List<RMContainer> getRunningContainers()

getReservedContainer

public RMContainer getReservedContainer()

setReservedContainer

protected void setReservedContainer(RMContainer reservedContainer)

recoverContainer

public void recoverContainer(RMContainer rmContainer)


Copyright © 2014 Apache Software Foundation. All Rights Reserved.