@InterfaceAudience.Private @InterfaceStability.Unstable public abstract class SchedulerNode extends Object
Constructor and Description |
---|
SchedulerNode(RMNode node,
boolean usePortForNodeName) |
SchedulerNode(RMNode node,
boolean usePortForNodeName,
Set<String> labels) |
Modifier and Type | Method and Description |
---|---|
void |
allocateContainer(RMContainer rmContainer)
The Scheduler has allocated containers on this node to the given
application.
|
protected void |
allocateContainer(RMContainer rmContainer,
boolean launchedOnNode)
The Scheduler has allocated containers on this node to the given
application.
|
void |
containerStarted(org.apache.hadoop.yarn.api.records.ContainerId containerId)
Inform the node that a container has launched.
|
void |
deductUnallocatedResource(org.apache.hadoop.yarn.api.records.Resource resource)
Deduct unallocated resources from the node.
|
boolean |
equals(Object o) |
org.apache.hadoop.yarn.api.records.ResourceUtilization |
getAggregatedContainersUtilization()
Get the resource utilization of the containers in the node.
|
org.apache.hadoop.yarn.api.records.Resource |
getAllocatedResource()
Get allocated resources on the node.
|
protected RMContainer |
getContainer(org.apache.hadoop.yarn.api.records.ContainerId containerId)
Get the container for the specified container ID.
|
List<RMContainer> |
getContainersToKill()
Get the containers running on the node ordered by which to kill first.
|
List<RMContainer> |
getCopiedListOfRunningContainers()
Get the containers running on the node.
|
String |
getHttpAddress()
Get HTTP address for the node.
|
Set<String> |
getLabels()
Get the labels for the node.
|
long |
getLastHeartbeatMonotonicTime() |
protected List<RMContainer> |
getLaunchedContainers()
Get the launched containers in the node.
|
Set<org.apache.hadoop.yarn.api.records.NodeAttribute> |
getNodeAttributes() |
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.
|
org.apache.hadoop.yarn.api.records.ResourceUtilization |
getNodeUtilization()
Get the resource utilization of the node.
|
int |
getNumContainers()
Get number of active containers on the node.
|
String |
getPartition()
Get partition of which the node belongs to, if node-labels of this node is
empty or null, it belongs to NO_LABEL partition.
|
String |
getRackName()
Get rackname.
|
RMContainer |
getReservedContainer()
Get the reserved container in the node.
|
RMNode |
getRMNode() |
List<RMContainer> |
getRunningContainersWithAMsAtTheEnd()
Get the containers running on the node with AM containers at the end.
|
org.apache.hadoop.yarn.api.records.Resource |
getTotalResource()
Get total resources on the node.
|
org.apache.hadoop.yarn.api.records.Resource |
getUnallocatedResource()
Get unallocated resources on the node.
|
int |
hashCode() |
boolean |
isOvercommitTimedOut()
Check if the time out has passed.
|
boolean |
isOvercommitTimeOutSet()
Check if the node has a time out for overcommit resources.
|
boolean |
isValidContainer(org.apache.hadoop.yarn.api.records.ContainerId containerId)
Check if a container is launched by this node.
|
void |
notifyNodeUpdate()
This will be called for each node heartbeat.
|
void |
recoverContainer(RMContainer rmContainer)
Recover a container.
|
void |
releaseContainer(org.apache.hadoop.yarn.api.records.ContainerId containerId,
boolean releasedByNode)
Release an allocated container on this node.
|
abstract void |
reserveResource(SchedulerApplicationAttempt attempt,
org.apache.hadoop.yarn.server.scheduler.SchedulerRequestKey schedulerKey,
RMContainer container)
Reserve container for the attempt on this node.
|
void |
setAggregatedContainersUtilization(org.apache.hadoop.yarn.api.records.ResourceUtilization containersUtilization)
Set the resource utilization of the containers in the node.
|
void |
setNodeUtilization(org.apache.hadoop.yarn.api.records.ResourceUtilization nodeUtilization)
Set the resource utilization of the node.
|
void |
setOvercommitTimeOut(long timeOut)
Set the timeout for the node to stop overcommitting the resources.
|
void |
setReservedContainer(RMContainer reservedContainer)
Set the reserved container in the node.
|
String |
toString() |
abstract void |
unreserveResource(SchedulerApplicationAttempt attempt)
Unreserve resources on this node.
|
void |
updateLabels(Set<String> labels)
Update the labels for the node.
|
void |
updateNodeAttributes(Set<org.apache.hadoop.yarn.api.records.NodeAttribute> attributes) |
protected void |
updateResourceForReleasedContainer(org.apache.hadoop.yarn.api.records.Container container)
Update the resources of the node when releasing a container.
|
void |
updateTotalResource(org.apache.hadoop.yarn.api.records.Resource resource)
Set total resources on the node.
|
public SchedulerNode(RMNode node, boolean usePortForNodeName)
public RMNode getRMNode()
public void updateTotalResource(org.apache.hadoop.yarn.api.records.Resource resource)
resource
- Total resources on the node.public void setOvercommitTimeOut(long timeOut)
timeOut
- Time out in milliseconds.public boolean isOvercommitTimedOut()
public boolean isOvercommitTimeOutSet()
public org.apache.hadoop.yarn.api.records.NodeId getNodeID()
public String getHttpAddress()
public String getNodeName()
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.
public String getRackName()
public void allocateContainer(RMContainer rmContainer)
rmContainer
- Allocated containerprotected void allocateContainer(RMContainer rmContainer, boolean launchedOnNode)
rmContainer
- Allocated containerlaunchedOnNode
- True if the container has been launchedpublic org.apache.hadoop.yarn.api.records.Resource getUnallocatedResource()
public org.apache.hadoop.yarn.api.records.Resource getAllocatedResource()
public org.apache.hadoop.yarn.api.records.Resource getTotalResource()
public boolean isValidContainer(org.apache.hadoop.yarn.api.records.ContainerId containerId)
protected void updateResourceForReleasedContainer(org.apache.hadoop.yarn.api.records.Container container)
container
- Container to release.public void releaseContainer(org.apache.hadoop.yarn.api.records.ContainerId containerId, boolean releasedByNode)
containerId
- ID of container to be released.releasedByNode
- whether the release originates from a node update.public void containerStarted(org.apache.hadoop.yarn.api.records.ContainerId containerId)
containerId
- ID of the launched containerpublic void deductUnallocatedResource(org.apache.hadoop.yarn.api.records.Resource resource)
resource
- Resources to deduct.public abstract void reserveResource(SchedulerApplicationAttempt attempt, org.apache.hadoop.yarn.server.scheduler.SchedulerRequestKey schedulerKey, RMContainer container)
attempt
- Application attempt asking for the reservation.schedulerKey
- Priority of the reservation.container
- Container reserving resources for.public abstract void unreserveResource(SchedulerApplicationAttempt attempt)
attempt
- Application attempt that had done the reservation.public int getNumContainers()
public List<RMContainer> getCopiedListOfRunningContainers()
public List<RMContainer> getRunningContainersWithAMsAtTheEnd()
public List<RMContainer> getContainersToKill()
protected List<RMContainer> getLaunchedContainers()
protected RMContainer getContainer(org.apache.hadoop.yarn.api.records.ContainerId containerId)
containerId
- The container IDpublic RMContainer getReservedContainer()
public void setReservedContainer(RMContainer reservedContainer)
reservedContainer
- Reserved container in the node.public void recoverContainer(RMContainer rmContainer)
rmContainer
- Container to recover.public Set<String> getLabels()
public void updateLabels(Set<String> labels)
labels
- Set of labels for the node.public String getPartition()
public void setAggregatedContainersUtilization(org.apache.hadoop.yarn.api.records.ResourceUtilization containersUtilization)
containersUtilization
- Resource utilization of the containers.public org.apache.hadoop.yarn.api.records.ResourceUtilization getAggregatedContainersUtilization()
public void setNodeUtilization(org.apache.hadoop.yarn.api.records.ResourceUtilization nodeUtilization)
nodeUtilization
- Resource utilization of the node.public org.apache.hadoop.yarn.api.records.ResourceUtilization getNodeUtilization()
public long getLastHeartbeatMonotonicTime()
public void notifyNodeUpdate()
public Set<org.apache.hadoop.yarn.api.records.NodeAttribute> getNodeAttributes()
public void updateNodeAttributes(Set<org.apache.hadoop.yarn.api.records.NodeAttribute> attributes)
Copyright © 2008–2021 Apache Software Foundation. All rights reserved.