java.io.Closeable, java.lang.AutoCloseable, org.apache.hadoop.service.Servicepublic class NodeAttributesManagerImpl
extends org.apache.hadoop.yarn.nodelabels.NodeAttributesManager
| Modifier and Type | Class | Description |
|---|---|---|
static class |
NodeAttributesManagerImpl.Host |
A
Host can have multiple Nodes. |
| Modifier and Type | Field | Description |
|---|---|---|
static java.lang.String |
EMPTY_ATTRIBUTE_VALUE |
If a user doesn't specify value for a label, then empty string is
considered as default.
|
protected static org.slf4j.Logger |
LOG |
| Constructor | Description |
|---|---|
NodeAttributesManagerImpl() |
| Modifier and Type | Method | Description |
|---|---|---|
void |
activateNode(org.apache.hadoop.yarn.api.records.NodeId nodeId,
org.apache.hadoop.yarn.api.records.Resource resource) |
|
void |
addNodeAttributes(java.util.Map<java.lang.String,java.util.Set<org.apache.hadoop.yarn.api.records.NodeAttribute>> nodeAttributeMapping) |
|
void |
deactivateNode(org.apache.hadoop.yarn.api.records.NodeId nodeId) |
|
java.util.Map<org.apache.hadoop.yarn.api.records.NodeAttribute,org.apache.hadoop.yarn.nodelabels.AttributeValue> |
getAttributesForNode(java.lang.String hostName) |
|
java.util.Map<org.apache.hadoop.yarn.api.records.NodeAttributeKey,java.util.Map<java.lang.String,org.apache.hadoop.yarn.nodelabels.AttributeValue>> |
getAttributesToNodes(java.util.Set<org.apache.hadoop.yarn.api.records.NodeAttributeKey> attributes) |
|
java.util.Set<org.apache.hadoop.yarn.api.records.NodeAttribute> |
getClusterNodeAttributes(java.util.Set<java.lang.String> prefix) |
|
java.util.Map<java.lang.String,java.util.Set<org.apache.hadoop.yarn.api.records.NodeAttribute>> |
getNodesToAttributes(java.util.Set<java.lang.String> hostNames) |
|
java.util.List<org.apache.hadoop.yarn.server.api.protocolrecords.NodeToAttributes> |
getNodeToAttributes(java.util.Set<java.lang.String> prefix) |
|
org.apache.hadoop.yarn.api.records.Resource |
getResourceByAttribute(org.apache.hadoop.yarn.api.records.NodeAttribute attribute) |
|
protected void |
handleStoreEvent(NodeAttributesStoreEvent event) |
|
protected void |
initDispatcher(org.apache.hadoop.conf.Configuration conf) |
|
protected void |
initNodeAttributeStore(org.apache.hadoop.conf.Configuration conf) |
|
protected void |
internalUpdateAttributesOnNodes(java.util.Map<java.lang.String,java.util.Map<org.apache.hadoop.yarn.api.records.NodeAttribute,org.apache.hadoop.yarn.nodelabels.AttributeValue>> nodeAttributeMapping,
org.apache.hadoop.yarn.server.api.protocolrecords.AttributeMappingOperationType op,
java.util.Map<org.apache.hadoop.yarn.api.records.NodeAttributeKey,org.apache.hadoop.yarn.nodelabels.RMNodeAttribute> newAttributesToBeAdded,
java.lang.String attributePrefix) |
|
protected java.lang.String |
normalizeAttributeValue(java.lang.String value) |
|
void |
refreshNodeAttributesToScheduler(org.apache.hadoop.yarn.api.records.NodeId nodeId) |
Refresh node attributes on a given node during RM recovery.
|
void |
removeNodeAttributes(java.util.Map<java.lang.String,java.util.Set<org.apache.hadoop.yarn.api.records.NodeAttribute>> nodeAttributeMapping) |
|
void |
replaceNodeAttributes(java.lang.String prefix,
java.util.Map<java.lang.String,java.util.Set<org.apache.hadoop.yarn.api.records.NodeAttribute>> nodeAttributeMapping) |
|
protected void |
serviceStart() |
|
protected void |
serviceStop() |
|
void |
setRMContext(RMContext context) |
|
protected void |
startDispatcher() |
|
protected void |
stopDispatcher() |
|
void |
updateNodeResource(org.apache.hadoop.yarn.api.records.NodeId node,
org.apache.hadoop.yarn.api.records.Resource newResource) |
|
protected java.util.Map<java.lang.String,java.util.Map<org.apache.hadoop.yarn.api.records.NodeAttribute,org.apache.hadoop.yarn.nodelabels.AttributeValue>> |
validate(java.util.Map<java.lang.String,java.util.Set<org.apache.hadoop.yarn.api.records.NodeAttribute>> nodeAttributeMapping,
java.util.Map<org.apache.hadoop.yarn.api.records.NodeAttributeKey,org.apache.hadoop.yarn.nodelabels.RMNodeAttribute> newAttributesToBeAdded,
boolean isRemoveOperation) |
Validate for attributes.
|
close, getBlockers, getConfig, getFailureCause, getFailureState, getLifecycleHistory, getName, getServiceState, getStartTime, init, isInState, noteFailure, putBlocker, registerGlobalListener, registerServiceListener, removeBlocker, serviceInit, setConfig, start, stop, toString, unregisterGlobalListener, unregisterServiceListener, waitForServiceToStopprotected static final org.slf4j.Logger LOG
public static final java.lang.String EMPTY_ATTRIBUTE_VALUE
protected void initDispatcher(org.apache.hadoop.conf.Configuration conf)
protected void startDispatcher()
protected void serviceStart()
throws java.lang.Exception
serviceStart in class org.apache.hadoop.service.AbstractServicejava.lang.Exceptionprotected void initNodeAttributeStore(org.apache.hadoop.conf.Configuration conf)
throws java.lang.Exception
java.lang.Exception@VisibleForTesting
protected void internalUpdateAttributesOnNodes(java.util.Map<java.lang.String,java.util.Map<org.apache.hadoop.yarn.api.records.NodeAttribute,org.apache.hadoop.yarn.nodelabels.AttributeValue>> nodeAttributeMapping,
org.apache.hadoop.yarn.server.api.protocolrecords.AttributeMappingOperationType op,
java.util.Map<org.apache.hadoop.yarn.api.records.NodeAttributeKey,org.apache.hadoop.yarn.nodelabels.RMNodeAttribute> newAttributesToBeAdded,
java.lang.String attributePrefix)
protected java.util.Map<java.lang.String,java.util.Map<org.apache.hadoop.yarn.api.records.NodeAttribute,org.apache.hadoop.yarn.nodelabels.AttributeValue>> validate(java.util.Map<java.lang.String,java.util.Set<org.apache.hadoop.yarn.api.records.NodeAttribute>> nodeAttributeMapping,
java.util.Map<org.apache.hadoop.yarn.api.records.NodeAttributeKey,org.apache.hadoop.yarn.nodelabels.RMNodeAttribute> newAttributesToBeAdded,
boolean isRemoveOperation)
throws java.io.IOException
nodeAttributeMapping - NodeAttribute MappingnewAttributesToBeAdded - new Attributes ToBeAddedisRemoveOperation - : to indicate whether it's a remove operation.java.io.IOException - : on invalid mapping in the current request or against
already existing NodeAttributes.protected java.lang.String normalizeAttributeValue(java.lang.String value)
public java.util.Set<org.apache.hadoop.yarn.api.records.NodeAttribute> getClusterNodeAttributes(java.util.Set<java.lang.String> prefix)
getClusterNodeAttributes in class org.apache.hadoop.yarn.nodelabels.NodeAttributesManagerpublic java.util.Map<org.apache.hadoop.yarn.api.records.NodeAttributeKey,java.util.Map<java.lang.String,org.apache.hadoop.yarn.nodelabels.AttributeValue>> getAttributesToNodes(java.util.Set<org.apache.hadoop.yarn.api.records.NodeAttributeKey> attributes)
getAttributesToNodes in class org.apache.hadoop.yarn.nodelabels.NodeAttributesManagerpublic org.apache.hadoop.yarn.api.records.Resource getResourceByAttribute(org.apache.hadoop.yarn.api.records.NodeAttribute attribute)
public java.util.Map<org.apache.hadoop.yarn.api.records.NodeAttribute,org.apache.hadoop.yarn.nodelabels.AttributeValue> getAttributesForNode(java.lang.String hostName)
getAttributesForNode in class org.apache.hadoop.yarn.nodelabels.NodeAttributesManagerpublic java.util.List<org.apache.hadoop.yarn.server.api.protocolrecords.NodeToAttributes> getNodeToAttributes(java.util.Set<java.lang.String> prefix)
getNodeToAttributes in class org.apache.hadoop.yarn.nodelabels.NodeAttributesManagerpublic java.util.Map<java.lang.String,java.util.Set<org.apache.hadoop.yarn.api.records.NodeAttribute>> getNodesToAttributes(java.util.Set<java.lang.String> hostNames)
getNodesToAttributes in class org.apache.hadoop.yarn.nodelabels.NodeAttributesManagerpublic void activateNode(org.apache.hadoop.yarn.api.records.NodeId nodeId,
org.apache.hadoop.yarn.api.records.Resource resource)
public void deactivateNode(org.apache.hadoop.yarn.api.records.NodeId nodeId)
public void updateNodeResource(org.apache.hadoop.yarn.api.records.NodeId node,
org.apache.hadoop.yarn.api.records.Resource newResource)
protected void handleStoreEvent(NodeAttributesStoreEvent event)
public void replaceNodeAttributes(java.lang.String prefix,
java.util.Map<java.lang.String,java.util.Set<org.apache.hadoop.yarn.api.records.NodeAttribute>> nodeAttributeMapping)
throws java.io.IOException
replaceNodeAttributes in class org.apache.hadoop.yarn.nodelabels.NodeAttributesManagerjava.io.IOExceptionpublic void addNodeAttributes(java.util.Map<java.lang.String,java.util.Set<org.apache.hadoop.yarn.api.records.NodeAttribute>> nodeAttributeMapping)
throws java.io.IOException
addNodeAttributes in class org.apache.hadoop.yarn.nodelabels.NodeAttributesManagerjava.io.IOExceptionpublic void removeNodeAttributes(java.util.Map<java.lang.String,java.util.Set<org.apache.hadoop.yarn.api.records.NodeAttribute>> nodeAttributeMapping)
throws java.io.IOException
removeNodeAttributes in class org.apache.hadoop.yarn.nodelabels.NodeAttributesManagerjava.io.IOExceptionprotected void stopDispatcher()
protected void serviceStop()
throws java.lang.Exception
serviceStop in class org.apache.hadoop.service.AbstractServicejava.lang.Exceptionpublic void setRMContext(RMContext context)
public void refreshNodeAttributesToScheduler(org.apache.hadoop.yarn.api.records.NodeId nodeId)
refreshNodeAttributesToScheduler in class org.apache.hadoop.yarn.nodelabels.NodeAttributesManagernodeId - Node IdCopyright © 2008–2025 Apache Software Foundation. All rights reserved.