public class CommonNodeLabelsManager extends AbstractService
| Modifier and Type | Class and Description |
|---|---|
protected static class |
CommonNodeLabelsManager.Host
A
Host can have multiple Nodes |
protected static class |
CommonNodeLabelsManager.Node |
Service.STATE| Modifier and Type | Field and Description |
|---|---|
static Set<String> |
ACCESS_ANY_LABEL_SET |
static String |
ANY |
protected Dispatcher |
dispatcher |
static Set<String> |
EMPTY_STRING_SET |
protected ConcurrentMap<String,NodeLabel> |
labelCollections |
protected static org.apache.commons.logging.Log |
LOG |
static String |
NO_LABEL
If a user doesn't specify label of a queue or node, it belongs
DEFAULT_LABEL
|
static String |
NODE_LABELS_NOT_ENABLED_ERR
Error messages
|
protected ConcurrentMap<String,CommonNodeLabelsManager.Host> |
nodeCollections |
protected ReentrantReadWriteLock.ReadLock |
readLock |
protected NodeLabelsStore |
store |
static int |
WILDCARD_PORT |
protected ReentrantReadWriteLock.WriteLock |
writeLock |
| Constructor and Description |
|---|
CommonNodeLabelsManager() |
close, getBlockers, getConfig, getFailureCause, getFailureState, getLifecycleHistory, getName, getServiceState, getStartTime, init, isInState, noteFailure, putBlocker, registerGlobalListener, registerServiceListener, removeBlocker, setConfig, start, stop, toString, unregisterGlobalListener, unregisterServiceListener, waitForServiceToStopprotected static final org.apache.commons.logging.Log LOG
public static final String ANY
public static final int WILDCARD_PORT
public static final String NODE_LABELS_NOT_ENABLED_ERR
public static final String NO_LABEL
protected Dispatcher dispatcher
protected ConcurrentMap<String,NodeLabel> labelCollections
protected ConcurrentMap<String,CommonNodeLabelsManager.Host> nodeCollections
protected final ReentrantReadWriteLock.ReadLock readLock
protected final ReentrantReadWriteLock.WriteLock writeLock
protected NodeLabelsStore store
protected void handleStoreEvent(NodeLabelsStoreEvent event)
protected void initDispatcher(Configuration conf)
protected void serviceInit(Configuration conf) throws Exception
serviceInit in class AbstractServiceExceptionprotected void initNodeLabelStore(Configuration conf) throws Exception
Exceptionprotected void startDispatcher()
protected void serviceStart()
throws Exception
serviceStart in class AbstractServiceExceptionprotected void stopDispatcher()
protected void serviceStop()
throws Exception
serviceStop in class AbstractServiceExceptionpublic void addToCluserNodeLabels(Set<String> labels) throws IOException
labels - new node labels addedIOExceptionprotected void checkAddLabelsToNode(Map<NodeId,Set<String>> addedLabelsToNode) throws IOException
IOExceptionpublic void addLabelsToNode(Map<NodeId,Set<String>> addedLabelsToNode) throws IOException
addedLabelsToNode - node -> labels mapIOExceptionprotected void checkRemoveFromClusterNodeLabels(Collection<String> labelsToRemove) throws IOException
IOExceptionprotected void internalRemoveFromClusterNodeLabels(Collection<String> labelsToRemove)
public void removeFromClusterNodeLabels(Collection<String> labelsToRemove) throws IOException
labelsToRemove - node labels to removeIOExceptionprotected void checkRemoveLabelsFromNode(Map<NodeId,Set<String>> removeLabelsFromNode) throws IOException
IOExceptionprotected void internalUpdateLabelsOnNodes(Map<NodeId,Set<String>> nodeToLabels, org.apache.hadoop.yarn.nodelabels.CommonNodeLabelsManager.NodeLabelUpdateOperation op) throws IOException
IOExceptionpublic void removeLabelsFromNode(Map<NodeId,Set<String>> removeLabelsFromNode) throws IOException
removeLabelsFromNode - node -> labels mapIOExceptionprotected void checkReplaceLabelsOnNode(Map<NodeId,Set<String>> replaceLabelsToNode) throws IOException
IOExceptionpublic void replaceLabelsOnNode(Map<NodeId,Set<String>> replaceLabelsToNode) throws IOException
replaceLabelsToNode - node -> labels mapIOExceptionpublic Map<NodeId,Set<String>> getNodeLabels()
public Map<String,Set<NodeId>> getLabelsToNodes()
public Map<String,Set<NodeId>> getLabelsToNodes(Set<String> labels)
labels - set of labels for which labels to nodes mapping will be
returned.public Set<String> getClusterNodeLabels()
protected CommonNodeLabelsManager.Node getNMInNodeSet(NodeId nodeId)
protected CommonNodeLabelsManager.Node getNMInNodeSet(NodeId nodeId, Map<String,CommonNodeLabelsManager.Host> map)
protected CommonNodeLabelsManager.Node getNMInNodeSet(NodeId nodeId, Map<String,CommonNodeLabelsManager.Host> map, boolean checkRunning)
protected Set<String> getLabelsByNode(NodeId nodeId, Map<String,CommonNodeLabelsManager.Host> map)
protected void createNodeIfNonExisted(NodeId nodeId) throws IOException
IOExceptionprotected void createHostIfNonExisted(String hostName)
Copyright © 2018 CERN. All Rights Reserved.