@Private
public class ClusterNodeTracker<N extends SchedulerNode>
extends java.lang.Object
SchedulerNodes
- provides convenience methods to filter and sort nodes| Constructor | Description |
|---|---|
ClusterNodeTracker() |
| Modifier and Type | Method | Description |
|---|---|---|
void |
addNode(N node) |
|
boolean |
exists(org.apache.hadoop.yarn.api.records.NodeId nodeId) |
|
java.util.List<org.apache.hadoop.yarn.api.records.NodeId> |
getAllNodeIds() |
|
java.util.List<N> |
getAllNodes() |
|
org.apache.hadoop.yarn.api.records.Resource |
getClusterCapacity() |
|
org.apache.hadoop.yarn.api.records.Resource |
getClusterCapacity(java.util.Set<org.apache.hadoop.yarn.api.records.NodeId> nodesByLabel) |
|
org.apache.hadoop.yarn.api.records.Resource |
getMaxAllowedAllocation() |
|
N |
getNode(org.apache.hadoop.yarn.api.records.NodeId nodeId) |
|
java.util.List<org.apache.hadoop.yarn.api.records.NodeId> |
getNodeIds(NodeFilter nodeFilter) |
Convenience method to filter nodes based on a condition.
|
java.util.List<org.apache.hadoop.yarn.api.records.NodeId> |
getNodeIdsByResourceName(java.lang.String resourceName) |
Convenience method to return list of
NodeId corresponding to
resourceName passed in the ResourceRequest. |
SchedulerNodeReport |
getNodeReport(org.apache.hadoop.yarn.api.records.NodeId nodeId) |
|
java.util.List<N> |
getNodes(NodeFilter nodeFilter) |
Convenience method to filter nodes based on a condition.
|
java.util.List<N> |
getNodesByResourceName(java.lang.String resourceName) |
Convenience method to return list of nodes corresponding to resourceName
passed in the
ResourceRequest. |
java.util.List<N> |
getNodesPerPartition(java.lang.String partition) |
|
java.util.List<java.lang.String> |
getPartitions() |
|
int |
nodeCount() |
|
int |
nodeCount(java.lang.String rackName) |
|
N |
removeNode(org.apache.hadoop.yarn.api.records.NodeId nodeId) |
|
void |
setConfiguredMaxAllocation(org.apache.hadoop.yarn.api.records.Resource resource) |
|
void |
setConfiguredMaxAllocationWaitTime(long configuredMaxAllocationWaitTime) |
|
void |
setForceConfiguredMaxAllocation(boolean flag) |
|
java.util.TreeSet<N> |
sortedNodeSet(java.util.Comparator<N> comparator) |
Convenience method to sort nodes.
|
void |
updateNodesPerPartition(java.lang.String partition,
java.util.Set<org.apache.hadoop.yarn.api.records.NodeId> nodeIds) |
update cached nodes per partition on a node label change event.
|
public void addNode(N node)
public boolean exists(org.apache.hadoop.yarn.api.records.NodeId nodeId)
public N getNode(org.apache.hadoop.yarn.api.records.NodeId nodeId)
public SchedulerNodeReport getNodeReport(org.apache.hadoop.yarn.api.records.NodeId nodeId)
public int nodeCount()
public int nodeCount(java.lang.String rackName)
public org.apache.hadoop.yarn.api.records.Resource getClusterCapacity()
public org.apache.hadoop.yarn.api.records.Resource getClusterCapacity(java.util.Set<org.apache.hadoop.yarn.api.records.NodeId> nodesByLabel)
public N removeNode(org.apache.hadoop.yarn.api.records.NodeId nodeId)
public void setConfiguredMaxAllocation(org.apache.hadoop.yarn.api.records.Resource resource)
public void setConfiguredMaxAllocationWaitTime(long configuredMaxAllocationWaitTime)
public org.apache.hadoop.yarn.api.records.Resource getMaxAllowedAllocation()
@VisibleForTesting public void setForceConfiguredMaxAllocation(boolean flag)
public java.util.List<N> getAllNodes()
public java.util.List<N> getNodes(NodeFilter nodeFilter)
nodeFilter - A NodeFilter for filtering the nodespublic java.util.List<org.apache.hadoop.yarn.api.records.NodeId> getAllNodeIds()
public java.util.List<org.apache.hadoop.yarn.api.records.NodeId> getNodeIds(NodeFilter nodeFilter)
nodeFilter - A NodeFilter for filtering the nodespublic java.util.TreeSet<N> sortedNodeSet(java.util.Comparator<N> comparator)
comparator - the comparator to sort the nodes withpublic java.util.List<N> getNodesByResourceName(java.lang.String resourceName)
ResourceRequest.resourceName - Host/rack name of the resource, or
ResourceRequest.ANYpublic java.util.List<org.apache.hadoop.yarn.api.records.NodeId> getNodeIdsByResourceName(java.lang.String resourceName)
NodeId corresponding to
resourceName passed in the ResourceRequest.resourceName - Host/rack name of the resource, or
ResourceRequest.ANYNodeId that match the resourceNamepublic void updateNodesPerPartition(java.lang.String partition,
java.util.Set<org.apache.hadoop.yarn.api.records.NodeId> nodeIds)
partition - nodeLabelnodeIds - List of Node IDspublic java.util.List<N> getNodesPerPartition(java.lang.String partition)
public java.util.List<java.lang.String> getPartitions()
Copyright © 2008–2025 Apache Software Foundation. All rights reserved.