Class RMNodeImpl
java.lang.Object
org.apache.hadoop.yarn.server.resourcemanager.rmnode.RMNodeImpl
- All Implemented Interfaces:
org.apache.hadoop.yarn.event.EventHandler<RMNodeEvent>,RMNode
@Private
@Unstable
public class RMNodeImpl
extends Object
implements RMNode, org.apache.hadoop.yarn.event.EventHandler<RMNodeEvent>
This class is used to keep track of all the applications/containers
running on a node.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic classstatic classstatic classstatic classstatic classThe transition to put node in decommissioning state.static classstatic classstatic classstatic classStatus update transition when node is healthy.static classstatic classTransition to Update a container.static classstatic class -
Constructor Summary
ConstructorsConstructorDescriptionRMNodeImpl(org.apache.hadoop.yarn.api.records.NodeId nodeId, RMContext context, String hostName, int cmPort, int httpPort, org.apache.hadoop.net.Node node, org.apache.hadoop.yarn.api.records.Resource capability, String nodeManagerVersion) RMNodeImpl(org.apache.hadoop.yarn.api.records.NodeId nodeId, RMContext context, String hostName, int cmPort, int httpPort, org.apache.hadoop.net.Node node, org.apache.hadoop.yarn.api.records.Resource capability, String nodeManagerVersion, org.apache.hadoop.yarn.api.records.Resource physResource) -
Method Summary
Modifier and TypeMethodDescriptionlongcalculateHeartBeatInterval(long defaultInterval, long minInterval, long maxInterval, float speedupFactor, float slowdownFactor) static voiddeactivateNode(RMNodeImpl rmNode, org.apache.hadoop.yarn.api.records.NodeState finalState) Put a node in deactivated (decommissioned or shutdown) status.org.apache.hadoop.yarn.api.records.ResourceUtilizationthe aggregated resource utilization of the containers.Set<org.apache.hadoop.yarn.api.records.NodeAttribute>org.apache.hadoop.yarn.api.records.ResourceThe total allocated resources to containers.Get the allocation tags and their counts associated with this node.List<org.apache.hadoop.yarn.api.records.ApplicationId>intthe command port for this nodeSet<org.apache.hadoop.yarn.api.records.ContainerId>Set<org.apache.hadoop.yarn.api.records.ContainerId>List<org.apache.hadoop.yarn.api.records.ContainerId>the latest health report received from this node.the hostname of this nodethe http-Address for this node.intthe http port for this nodelongthe time of the latest health report received from this node.org.apache.hadoop.yarn.server.api.protocolrecords.NodeHeartbeatResponseSet<org.apache.hadoop.yarn.api.records.ContainerId>org.apache.hadoop.net.NodegetNode()theNodeinformation for this node.the ContainerManager address for this node.org.apache.hadoop.yarn.api.records.NodeIdthe node id of of this node.Get set of labels in this nodethe node manager version of the node received as part of the registration with the resource manager.org.apache.hadoop.yarn.api.records.ResourceUtilizationthe total resource utilization of the node.org.apache.hadoop.yarn.server.api.records.OpportunisticContainersStatusorg.apache.hadoop.yarn.api.records.Resourceorg.apache.hadoop.yarn.api.records.Resourcethe physical resources in the node.intThe rack name for this node manager.List<org.apache.hadoop.yarn.api.records.ApplicationId>org.apache.hadoop.yarn.api.records.NodeStategetState()Collection<org.apache.hadoop.yarn.api.records.Container>org.apache.hadoop.yarn.api.records.Resourcethe total available resource.longMap<org.apache.hadoop.yarn.api.records.ContainerId,org.apache.hadoop.yarn.api.records.ContainerStatus> voidhandle(RMNodeEvent event) booleanIf the total available resources has been updated.Get and clear the list of containerUpdates accumulated across NM heartbeats.List<org.apache.hadoop.yarn.api.records.Container>static voidreportNodeRunning(RMNodeImpl rmNode, List<org.apache.hadoop.yarn.server.api.protocolrecords.NMContainerStatus> containers) Report node is RUNNING.static voidreportNodeUnusable(RMNodeImpl rmNode, org.apache.hadoop.yarn.api.records.NodeState finalState) Report node is UNUSABLE and update metrics.voidReset lastNodeHeartbeatResponse's ID to 0.voidMark that the updated event has been processed.voidsetAggregatedContainersUtilization(org.apache.hadoop.yarn.api.records.ResourceUtilization containersUtilization) voidsetAndUpdateNodeHeartbeatResponse(org.apache.hadoop.yarn.server.api.protocolrecords.NodeHeartbeatResponse response) Update aNodeHeartbeatResponsewith the list of containers and applications to clean up for this node, and the containers to be updated.voidsetHealthReport(String healthReport) voidsetHttpPort(int port) voidsetLastHealthReportTime(long lastHealthReportTime) voidsetNextHeartBeat(boolean nextHeartBeat) voidsetNodeUtilization(org.apache.hadoop.yarn.api.records.ResourceUtilization nodeUtilization) voidsetOpportunisticContainersStatus(org.apache.hadoop.yarn.server.api.records.OpportunisticContainersStatus opportunisticContainersStatus) voidsetPhysicalResource(org.apache.hadoop.yarn.api.records.Resource physicalResource) voidsetUntrackedTimeStamp(long ts) toString()
-
Constructor Details
-
RMNodeImpl
-
RMNodeImpl
public RMNodeImpl(org.apache.hadoop.yarn.api.records.NodeId nodeId, RMContext context, String hostName, int cmPort, int httpPort, org.apache.hadoop.net.Node node, org.apache.hadoop.yarn.api.records.Resource capability, String nodeManagerVersion, org.apache.hadoop.yarn.api.records.Resource physResource)
-
-
Method Details
-
toString
-
getHostName
Description copied from interface:RMNodethe hostname of this node- Specified by:
getHostNamein interfaceRMNode- Returns:
- hostname of this node
-
getCommandPort
public int getCommandPort()Description copied from interface:RMNodethe command port for this node- Specified by:
getCommandPortin interfaceRMNode- Returns:
- command port for this node
-
getHttpPort
public int getHttpPort()Description copied from interface:RMNodethe http port for this node- Specified by:
getHttpPortin interfaceRMNode- Returns:
- http port for this node
-
setHttpPort
public void setHttpPort(int port) -
getNodeID
public org.apache.hadoop.yarn.api.records.NodeId getNodeID()Description copied from interface:RMNodethe node id of of this node. -
getNodeAddress
Description copied from interface:RMNodethe ContainerManager address for this node.- Specified by:
getNodeAddressin interfaceRMNode- Returns:
- the ContainerManager address for this node.
-
getHttpAddress
Description copied from interface:RMNodethe http-Address for this node.- Specified by:
getHttpAddressin interfaceRMNode- Returns:
- the http-url address for this node
-
getTotalCapability
public org.apache.hadoop.yarn.api.records.Resource getTotalCapability()Description copied from interface:RMNodethe total available resource.- Specified by:
getTotalCapabilityin interfaceRMNode- Returns:
- the total available resource.
-
getAllocatedContainerResource
public org.apache.hadoop.yarn.api.records.Resource getAllocatedContainerResource()Description copied from interface:RMNodeThe total allocated resources to containers. This will include the sum of Guaranteed and Opportunistic containers queued + running + paused on the node.- Specified by:
getAllocatedContainerResourcein interfaceRMNode- Returns:
- the total allocated resources, including all Guaranteed and Opportunistic containers in queued, running and paused states.
-
isUpdatedCapability
public boolean isUpdatedCapability()Description copied from interface:RMNodeIf the total available resources has been updated.- Specified by:
isUpdatedCapabilityin interfaceRMNode- Returns:
- If the capability has been updated.
-
resetUpdatedCapability
public void resetUpdatedCapability()Description copied from interface:RMNodeMark that the updated event has been processed.- Specified by:
resetUpdatedCapabilityin interfaceRMNode
-
getRackName
Description copied from interface:RMNodeThe rack name for this node manager.- Specified by:
getRackNamein interfaceRMNode- Returns:
- the rack name.
-
getNode
public org.apache.hadoop.net.Node getNode()Description copied from interface:RMNodetheNodeinformation for this node. -
getHealthReport
Description copied from interface:RMNodethe latest health report received from this node.- Specified by:
getHealthReportin interfaceRMNode- Returns:
- the latest health report received from this node.
-
setHealthReport
-
setLastHealthReportTime
public void setLastHealthReportTime(long lastHealthReportTime) -
getLastHealthReportTime
public long getLastHealthReportTime()Description copied from interface:RMNodethe time of the latest health report received from this node.- Specified by:
getLastHealthReportTimein interfaceRMNode- Returns:
- the time of the latest health report received from this node.
-
getNodeManagerVersion
Description copied from interface:RMNodethe node manager version of the node received as part of the registration with the resource manager.- Specified by:
getNodeManagerVersionin interfaceRMNode- Returns:
- node manager version.
-
getAggregatedContainersUtilization
public org.apache.hadoop.yarn.api.records.ResourceUtilization getAggregatedContainersUtilization()Description copied from interface:RMNodethe aggregated resource utilization of the containers.- Specified by:
getAggregatedContainersUtilizationin interfaceRMNode- Returns:
- the aggregated resource utilization of the containers.
-
setAggregatedContainersUtilization
public void setAggregatedContainersUtilization(org.apache.hadoop.yarn.api.records.ResourceUtilization containersUtilization) -
getNodeUtilization
public org.apache.hadoop.yarn.api.records.ResourceUtilization getNodeUtilization()Description copied from interface:RMNodethe total resource utilization of the node.- Specified by:
getNodeUtilizationin interfaceRMNode- Returns:
- the total resource utilization of the node.
-
setNodeUtilization
public void setNodeUtilization(org.apache.hadoop.yarn.api.records.ResourceUtilization nodeUtilization) -
getPhysicalResource
public org.apache.hadoop.yarn.api.records.Resource getPhysicalResource()Description copied from interface:RMNodethe physical resources in the node.- Specified by:
getPhysicalResourcein interfaceRMNode- Returns:
- the physical resources in the node.
-
setPhysicalResource
public void setPhysicalResource(org.apache.hadoop.yarn.api.records.Resource physicalResource) -
getState
public org.apache.hadoop.yarn.api.records.NodeState getState() -
getAppsToCleanup
- Specified by:
getAppsToCleanupin interfaceRMNode
-
getRunningApps
- Specified by:
getRunningAppsin interfaceRMNode
-
getContainersToCleanUp
- Specified by:
getContainersToCleanUpin interfaceRMNode
-
setAndUpdateNodeHeartbeatResponse
public void setAndUpdateNodeHeartbeatResponse(org.apache.hadoop.yarn.server.api.protocolrecords.NodeHeartbeatResponse response) Description copied from interface:RMNodeUpdate aNodeHeartbeatResponsewith the list of containers and applications to clean up for this node, and the containers to be updated.- Specified by:
setAndUpdateNodeHeartbeatResponsein interfaceRMNode- Parameters:
response- theNodeHeartbeatResponseto update
-
getToBeUpdatedContainers
@VisibleForTesting public Collection<org.apache.hadoop.yarn.api.records.Container> getToBeUpdatedContainers() -
getLastNodeHeartBeatResponse
public org.apache.hadoop.yarn.server.api.protocolrecords.NodeHeartbeatResponse getLastNodeHeartBeatResponse()- Specified by:
getLastNodeHeartBeatResponsein interfaceRMNode
-
resetLastNodeHeartBeatResponse
public void resetLastNodeHeartBeatResponse()Description copied from interface:RMNodeReset lastNodeHeartbeatResponse's ID to 0.- Specified by:
resetLastNodeHeartBeatResponsein interfaceRMNode
-
calculateHeartBeatInterval
public long calculateHeartBeatInterval(long defaultInterval, long minInterval, long maxInterval, float speedupFactor, float slowdownFactor) - Specified by:
calculateHeartBeatIntervalin interfaceRMNode
-
handle
- Specified by:
handlein interfaceorg.apache.hadoop.yarn.event.EventHandler<RMNodeEvent>
-
deactivateNode
public static void deactivateNode(RMNodeImpl rmNode, org.apache.hadoop.yarn.api.records.NodeState finalState) Put a node in deactivated (decommissioned or shutdown) status.- Parameters:
rmNode- RMNode.finalState- NodeState.
-
reportNodeRunning
public static void reportNodeRunning(RMNodeImpl rmNode, List<org.apache.hadoop.yarn.server.api.protocolrecords.NMContainerStatus> containers) Report node is RUNNING.- Parameters:
rmNode- RMNode.containers- NMContainerStatus List.
-
reportNodeUnusable
public static void reportNodeUnusable(RMNodeImpl rmNode, org.apache.hadoop.yarn.api.records.NodeState finalState) Report node is UNUSABLE and update metrics.- Parameters:
rmNode- RMNode.finalState- NodeState.
-
pullContainerUpdates
Description copied from interface:RMNodeGet and clear the list of containerUpdates accumulated across NM heartbeats.- Specified by:
pullContainerUpdatesin interfaceRMNode- Returns:
- containerUpdates accumulated across NM heartbeats.
-
setNextHeartBeat
@VisibleForTesting public void setNextHeartBeat(boolean nextHeartBeat) -
getQueueSize
@VisibleForTesting public int getQueueSize() -
getUpdatedExistContainers
@VisibleForTesting public Map<org.apache.hadoop.yarn.api.records.ContainerId,org.apache.hadoop.yarn.api.records.ContainerStatus> getUpdatedExistContainers() -
getLaunchedContainers
@VisibleForTesting public Set<org.apache.hadoop.yarn.api.records.ContainerId> getLaunchedContainers() -
getCompletedContainers
@VisibleForTesting public Set<org.apache.hadoop.yarn.api.records.ContainerId> getCompletedContainers() -
getNodeLabels
Description copied from interface:RMNodeGet set of labels in this node- Specified by:
getNodeLabelsin interfaceRMNode- Returns:
- labels in this node
-
pullNewlyIncreasedContainers
- Specified by:
pullNewlyIncreasedContainersin interfaceRMNode
-
getOriginalTotalCapability
public org.apache.hadoop.yarn.api.records.Resource getOriginalTotalCapability() -
getOpportunisticContainersStatus
public org.apache.hadoop.yarn.server.api.records.OpportunisticContainersStatus getOpportunisticContainersStatus()- Specified by:
getOpportunisticContainersStatusin interfaceRMNode
-
setOpportunisticContainersStatus
public void setOpportunisticContainersStatus(org.apache.hadoop.yarn.server.api.records.OpportunisticContainersStatus opportunisticContainersStatus) -
getUntrackedTimeStamp
public long getUntrackedTimeStamp()- Specified by:
getUntrackedTimeStampin interfaceRMNode
-
setUntrackedTimeStamp
public void setUntrackedTimeStamp(long ts) - Specified by:
setUntrackedTimeStampin interfaceRMNode
-
getDecommissioningTimeout
- Specified by:
getDecommissioningTimeoutin interfaceRMNode
-
getAllocationTagsWithCount
Description copied from interface:RMNodeGet the allocation tags and their counts associated with this node.- Specified by:
getAllocationTagsWithCountin interfaceRMNode- Returns:
- a map of each allocation tag and its count.
-
getRMContext
- Specified by:
getRMContextin interfaceRMNode- Returns:
- the RM context associated with this RM node.
-
getAllNodeAttributes
- Specified by:
getAllNodeAttributesin interfaceRMNode- Returns:
- all node attributes as a Set.
-
getContainersToBeRemovedFromNM
@VisibleForTesting public Set<org.apache.hadoop.yarn.api.records.ContainerId> getContainersToBeRemovedFromNM()
-