public class NodeMap extends HashMap<String,NodeInstance>
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K,V>| Modifier and Type | Field and Description |
|---|---|
protected static org.slf4j.Logger |
log |
| Constructor and Description |
|---|
NodeMap(int roleSize)
Construct
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
buildOrUpdate(List<org.apache.hadoop.yarn.api.records.NodeReport> reports)
Test helper: build or update a cluster from a list of node reports
|
Object |
clone()
Clone point
|
List<NodeInstance> |
findAllNodesForRole(int role,
String label)
Scan the current node map for all nodes capable of hosting an instance
|
NodeInstance |
getOrCreate(String hostname)
Get the node instance for the specific node -creating it if needed
|
void |
insert(Collection<NodeInstance> nodes)
Insert a list of nodes into the map; overwrite any with that name
This is a bulk operation for testing.
|
List<NodeInstance> |
listActiveNodes(int role)
List the active nodes
|
void |
resetFailedRecently()
reset the failed recently counters
|
String |
toString() |
boolean |
updateNode(String hostname,
org.apache.hadoop.yarn.api.records.NodeReport report)
Update the node state.
|
clear, containsKey, containsValue, entrySet, get, isEmpty, keySet, put, putAll, remove, size, valuesequals, hashCodepublic NodeMap(int roleSize)
roleSize - number of rolespublic NodeInstance getOrCreate(String hostname)
hostname - nodepublic List<NodeInstance> listActiveNodes(int role)
role - rolepublic void resetFailedRecently()
public boolean updateNode(String hostname, org.apache.hadoop.yarn.api.records.NodeReport report)
NodeInstance.updateNode(NodeReport).hostname - host namereport - latest node reportpublic Object clone()
clone in class HashMap<String,NodeInstance>public void insert(Collection<NodeInstance> nodes)
nodes - collection of nodes.public boolean buildOrUpdate(List<org.apache.hadoop.yarn.api.records.NodeReport> reports)
reports - the list of reportspublic List<NodeInstance> findAllNodesForRole(int role, String label)
role - role IDlabel - label which must match, or "" for no label checkspublic String toString()
toString in class AbstractMap<String,NodeInstance>Copyright © 2014–2015 The Apache Software Foundation. All rights reserved.