@InterfaceAudience.Public
@InterfaceStability.Stable
public abstract class NMClient
extends org.apache.hadoop.service.AbstractService
Modifier and Type | Class and Description |
---|---|
protected static class |
NMClient.UpgradeOp |
Modifier | Constructor and Description |
---|---|
protected |
NMClient(String name) |
Modifier and Type | Method and Description |
---|---|
abstract void |
cleanupRunningContainersOnStop(boolean enabled)
Set whether the containers that are started by this client, and are
still running should be stopped when the client stops.
|
abstract void |
commitLastReInitialization(org.apache.hadoop.yarn.api.records.ContainerId containerId)
Commit last reInitialization of the specified container.
|
static NMClient |
createNMClient()
Create a new instance of NMClient.
|
static NMClient |
createNMClient(String name)
Create a new instance of NMClient.
|
abstract org.apache.hadoop.yarn.api.records.ContainerStatus |
getContainerStatus(org.apache.hadoop.yarn.api.records.ContainerId containerId,
org.apache.hadoop.yarn.api.records.NodeId nodeId)
Query the status of a container.
|
NMTokenCache |
getNMTokenCache()
Get the NM token cache of the
NMClient . |
org.apache.hadoop.yarn.api.records.NodeId |
getNodeIdOfStartedContainer(org.apache.hadoop.yarn.api.records.ContainerId containerId)
Get the NodeId of the node on which container is running.
|
abstract void |
increaseContainerResource(org.apache.hadoop.yarn.api.records.Container container)
Deprecated.
|
abstract void |
reInitializeContainer(org.apache.hadoop.yarn.api.records.ContainerId containerId,
org.apache.hadoop.yarn.api.records.ContainerLaunchContext containerLaunchContex,
boolean autoCommit)
Re-Initialize the Container.
|
abstract void |
restartContainer(org.apache.hadoop.yarn.api.records.ContainerId containerId)
Restart the specified container.
|
abstract void |
rollbackLastReInitialization(org.apache.hadoop.yarn.api.records.ContainerId containerId)
Rollback last reInitialization of the specified container.
|
void |
setNMTokenCache(NMTokenCache nmTokenCache)
Set the NM Token cache of the
NMClient . |
abstract Map<String,ByteBuffer> |
startContainer(org.apache.hadoop.yarn.api.records.Container container,
org.apache.hadoop.yarn.api.records.ContainerLaunchContext containerLaunchContext)
Start an allocated container.
|
abstract void |
stopContainer(org.apache.hadoop.yarn.api.records.ContainerId containerId,
org.apache.hadoop.yarn.api.records.NodeId nodeId)
Stop an started container.
|
abstract void |
updateContainerResource(org.apache.hadoop.yarn.api.records.Container container)
Update the resources of a container.
|
close, getBlockers, getConfig, getFailureCause, getFailureState, getLifecycleHistory, getName, getServiceState, getStartTime, init, isInState, noteFailure, putBlocker, registerGlobalListener, registerServiceListener, removeBlocker, serviceInit, serviceStart, serviceStop, setConfig, start, stop, toString, unregisterGlobalListener, unregisterServiceListener, waitForServiceToStop
@InterfaceAudience.Private protected NMClient(String name)
@InterfaceAudience.Public public static NMClient createNMClient()
@InterfaceAudience.Public public static NMClient createNMClient(String name)
public abstract Map<String,ByteBuffer> startContainer(org.apache.hadoop.yarn.api.records.Container container, org.apache.hadoop.yarn.api.records.ContainerLaunchContext containerLaunchContext) throws org.apache.hadoop.yarn.exceptions.YarnException, IOException
Start an allocated container.
The ApplicationMaster
or other applications that use the
client must provide the details of the allocated container, including the
Id, the assigned node's Id and the token via Container
. In
addition, the AM needs to provide the ContainerLaunchContext
as
well.
container
- the allocated containercontainerLaunchContext
- the context information needed by the
NodeManager
to launch the
containerorg.apache.hadoop.yarn.exceptions.YarnException
- YarnException.IOException
- IOException.@Deprecated public abstract void increaseContainerResource(org.apache.hadoop.yarn.api.records.Container container) throws org.apache.hadoop.yarn.exceptions.YarnException, IOException
Increase the resource of a container.
The ApplicationMaster
or other applications that use the
client must provide the details of the container, including the Id and
the target resource encapsulated in the updated container token via
Container
.
container
- the container with updated token.org.apache.hadoop.yarn.exceptions.YarnException
- YarnException.IOException
- IOException.public abstract void updateContainerResource(org.apache.hadoop.yarn.api.records.Container container) throws org.apache.hadoop.yarn.exceptions.YarnException, IOException
Update the resources of a container.
The ApplicationMaster
or other applications that use the
client must provide the details of the container, including the Id and
the target resource encapsulated in the updated container token via
Container
.
container
- the container with updated token.org.apache.hadoop.yarn.exceptions.YarnException
- YarnException.IOException
- IOException.public abstract void stopContainer(org.apache.hadoop.yarn.api.records.ContainerId containerId, org.apache.hadoop.yarn.api.records.NodeId nodeId) throws org.apache.hadoop.yarn.exceptions.YarnException, IOException
Stop an started container.
containerId
- the Id of the started containernodeId
- the Id of the NodeManager
org.apache.hadoop.yarn.exceptions.YarnException
- YarnException.IOException
- IOException.public abstract org.apache.hadoop.yarn.api.records.ContainerStatus getContainerStatus(org.apache.hadoop.yarn.api.records.ContainerId containerId, org.apache.hadoop.yarn.api.records.NodeId nodeId) throws org.apache.hadoop.yarn.exceptions.YarnException, IOException
Query the status of a container.
containerId
- the Id of the started containernodeId
- the Id of the NodeManager
org.apache.hadoop.yarn.exceptions.YarnException
- YarnException.IOException
- IOException.public abstract void reInitializeContainer(org.apache.hadoop.yarn.api.records.ContainerId containerId, org.apache.hadoop.yarn.api.records.ContainerLaunchContext containerLaunchContex, boolean autoCommit) throws org.apache.hadoop.yarn.exceptions.YarnException, IOException
Re-Initialize the Container.
containerId
- the Id of the container to Re-Initialize.containerLaunchContex
- the updated ContainerLaunchContext.autoCommit
- commit re-initialization automatically ?org.apache.hadoop.yarn.exceptions.YarnException
- YarnException.IOException
- IOException.public abstract void restartContainer(org.apache.hadoop.yarn.api.records.ContainerId containerId) throws org.apache.hadoop.yarn.exceptions.YarnException, IOException
Restart the specified container.
containerId
- the Id of the container to restart.org.apache.hadoop.yarn.exceptions.YarnException
- YarnException.IOException
- IOException.public abstract void rollbackLastReInitialization(org.apache.hadoop.yarn.api.records.ContainerId containerId) throws org.apache.hadoop.yarn.exceptions.YarnException, IOException
Rollback last reInitialization of the specified container.
containerId
- the Id of the container to restart.org.apache.hadoop.yarn.exceptions.YarnException
- YarnException.IOException
- IOException.public abstract void commitLastReInitialization(org.apache.hadoop.yarn.api.records.ContainerId containerId) throws org.apache.hadoop.yarn.exceptions.YarnException, IOException
Commit last reInitialization of the specified container.
containerId
- the Id of the container to commit reInitialize.org.apache.hadoop.yarn.exceptions.YarnException
- YarnException.IOException
- IOException.public abstract void cleanupRunningContainersOnStop(boolean enabled)
Set whether the containers that are started by this client, and are still running should be stopped when the client stops. By default, the feature should be enabled.
However, containers will be stopped only when service is stopped. i.e. afterAbstractService.stop()
.enabled
- whether the feature is enabled or notpublic void setNMTokenCache(NMTokenCache nmTokenCache)
NMClient
. This cache must be
shared with the AMRMClient
that requested the containers managed
by this NMClient
If a NM token cache is not set, the NMTokenCache.getSingleton()
singleton instance will be used.
nmTokenCache
- the NM token cache to use.public NMTokenCache getNMTokenCache()
NMClient
. This cache must be
shared with the AMRMClient
that requested the containers managed
by this NMClient
If a NM token cache is not set, the NMTokenCache.getSingleton()
singleton instance will be used.
public org.apache.hadoop.yarn.api.records.NodeId getNodeIdOfStartedContainer(org.apache.hadoop.yarn.api.records.ContainerId containerId)
containerId
- Container Id of the container.Copyright © 2008–2018 Apache Software Foundation. All rights reserved.