Class ClusterNodeTracker<N extends SchedulerNode>
java.lang.Object
org.apache.hadoop.yarn.server.resourcemanager.scheduler.ClusterNodeTracker<N>
Helper library that:
- tracks the state of all cluster
SchedulerNodes
- provides convenience methods to filter and sort nodes-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidbooleanexists(org.apache.hadoop.yarn.api.records.NodeId nodeId) List<org.apache.hadoop.yarn.api.records.NodeId>org.apache.hadoop.yarn.api.records.Resourceorg.apache.hadoop.yarn.api.records.ResourcegetNode(org.apache.hadoop.yarn.api.records.NodeId nodeId) List<org.apache.hadoop.yarn.api.records.NodeId>getNodeIds(NodeFilter nodeFilter) Convenience method to filter nodes based on a condition.List<org.apache.hadoop.yarn.api.records.NodeId>getNodeIdsByResourceName(String resourceName) Convenience method to return list ofNodeIdcorresponding to resourceName passed in theResourceRequest.getNodeReport(org.apache.hadoop.yarn.api.records.NodeId nodeId) getNodes(NodeFilter nodeFilter) Convenience method to filter nodes based on a condition.getNodesByResourceName(String resourceName) Convenience method to return list of nodes corresponding to resourceName passed in theResourceRequest.getNodesPerPartition(String partition) intintremoveNode(org.apache.hadoop.yarn.api.records.NodeId nodeId) voidsetConfiguredMaxAllocation(org.apache.hadoop.yarn.api.records.Resource resource) voidsetConfiguredMaxAllocationWaitTime(long configuredMaxAllocationWaitTime) voidsetForceConfiguredMaxAllocation(boolean flag) sortedNodeSet(Comparator<N> comparator) Convenience method to sort nodes.voidupdateNodesPerPartition(String partition, Set<org.apache.hadoop.yarn.api.records.NodeId> nodeIds) update cached nodes per partition on a node label change event.
-
Constructor Details
-
ClusterNodeTracker
public ClusterNodeTracker()
-
-
Method Details
-
addNode
-
exists
public boolean exists(org.apache.hadoop.yarn.api.records.NodeId nodeId) -
getNode
-
getNodeReport
-
nodeCount
public int nodeCount() -
nodeCount
-
getClusterCapacity
public org.apache.hadoop.yarn.api.records.Resource getClusterCapacity() -
removeNode
-
setConfiguredMaxAllocation
public void setConfiguredMaxAllocation(org.apache.hadoop.yarn.api.records.Resource resource) -
setConfiguredMaxAllocationWaitTime
public void setConfiguredMaxAllocationWaitTime(long configuredMaxAllocationWaitTime) -
getMaxAllowedAllocation
public org.apache.hadoop.yarn.api.records.Resource getMaxAllowedAllocation() -
setForceConfiguredMaxAllocation
@VisibleForTesting public void setForceConfiguredMaxAllocation(boolean flag) -
getAllNodes
-
getNodes
Convenience method to filter nodes based on a condition.- Parameters:
nodeFilter- ANodeFilterfor filtering the nodes- Returns:
- A list of filtered nodes
-
getAllNodeIds
-
getNodeIds
Convenience method to filter nodes based on a condition.- Parameters:
nodeFilter- ANodeFilterfor filtering the nodes- Returns:
- A list of filtered nodes
-
sortedNodeSet
Convenience method to sort nodes. Nodes can change while being sorted. Using a standard sort will fail without locking each node, the TreeSet handles this without locks.- Parameters:
comparator- the comparator to sort the nodes with- Returns:
- sorted set of nodes in the form of a TreeSet
-
getNodesByResourceName
Convenience method to return list of nodes corresponding to resourceName passed in theResourceRequest.- Parameters:
resourceName- Host/rack name of the resource, orResourceRequest.ANY- Returns:
- list of nodes that match the resourceName
-
getNodeIdsByResourceName
public List<org.apache.hadoop.yarn.api.records.NodeId> getNodeIdsByResourceName(String resourceName) Convenience method to return list ofNodeIdcorresponding to resourceName passed in theResourceRequest.- Parameters:
resourceName- Host/rack name of the resource, orResourceRequest.ANY- Returns:
- list of
NodeIdthat match the resourceName
-
updateNodesPerPartition
public void updateNodesPerPartition(String partition, Set<org.apache.hadoop.yarn.api.records.NodeId> nodeIds) update cached nodes per partition on a node label change event.- Parameters:
partition- nodeLabelnodeIds- List of Node IDs
-
getNodesPerPartition
-
getPartitions
-