@InterfaceAudience.Private public class ClusterNodeTracker<N extends SchedulerNode> extends Object
SchedulerNode
s
- provides convenience methods to filter and sort nodesConstructor and Description |
---|
ClusterNodeTracker() |
Modifier and Type | Method and Description |
---|---|
void |
addNode(N node) |
boolean |
exists(org.apache.hadoop.yarn.api.records.NodeId nodeId) |
List<org.apache.hadoop.yarn.api.records.NodeId> |
getAllNodeIds() |
List<N> |
getAllNodes() |
org.apache.hadoop.yarn.api.records.Resource |
getClusterCapacity() |
org.apache.hadoop.yarn.api.records.Resource |
getMaxAllowedAllocation() |
N |
getNode(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 of
NodeId corresponding to
resourceName passed in the ResourceRequest . |
SchedulerNodeReport |
getNodeReport(org.apache.hadoop.yarn.api.records.NodeId nodeId) |
List<N> |
getNodes(NodeFilter nodeFilter)
Convenience method to filter nodes based on a condition.
|
List<N> |
getNodesByResourceName(String resourceName)
Convenience method to return list of nodes corresponding to resourceName
passed in the
ResourceRequest . |
List<N> |
getNodesPerPartition(String partition) |
List<String> |
getPartitions() |
int |
nodeCount() |
int |
nodeCount(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) |
TreeSet<N> |
sortedNodeSet(Comparator<N> comparator)
Convenience method to sort nodes.
|
void |
updateNodesPerPartition(String partition,
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(String rackName)
public org.apache.hadoop.yarn.api.records.Resource getClusterCapacity()
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 List<N> getNodes(NodeFilter nodeFilter)
nodeFilter
- A NodeFilter
for filtering the nodespublic List<org.apache.hadoop.yarn.api.records.NodeId> getAllNodeIds()
public List<org.apache.hadoop.yarn.api.records.NodeId> getNodeIds(NodeFilter nodeFilter)
nodeFilter
- A NodeFilter
for filtering the nodespublic TreeSet<N> sortedNodeSet(Comparator<N> comparator)
comparator
- the comparator to sort the nodes withpublic List<N> getNodesByResourceName(String resourceName)
ResourceRequest
.resourceName
- Host/rack name of the resource, or
ResourceRequest.ANY
public List<org.apache.hadoop.yarn.api.records.NodeId> getNodeIdsByResourceName(String resourceName)
NodeId
corresponding to
resourceName passed in the ResourceRequest
.resourceName
- Host/rack name of the resource, or
ResourceRequest.ANY
NodeId
that match the resourceNamepublic void updateNodesPerPartition(String partition, Set<org.apache.hadoop.yarn.api.records.NodeId> nodeIds)
partition
- nodeLabelnodeIds
- List of Node IDsCopyright © 2008–2024 Apache Software Foundation. All rights reserved.