@InterfaceAudience.Public @InterfaceStability.Stable public abstract class NMClient extends AbstractService
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.
|
static NMClient |
createNMClient()
Create a new instance of NMClient.
|
static NMClient |
createNMClient(String name)
Create a new instance of NMClient.
|
abstract ContainerStatus |
getContainerStatus(ContainerId containerId,
NodeId nodeId)
Query the status of a container.
|
NMTokenCache |
getNMTokenCache()
Get the NM token cache of the
NMClient . |
void |
setNMTokenCache(NMTokenCache nmTokenCache)
Set the NM Token cache of the
NMClient . |
abstract Map<String,ByteBuffer> |
startContainer(Container container,
ContainerLaunchContext containerLaunchContext)
Start an allocated container.
|
abstract void |
stopContainer(ContainerId containerId,
NodeId nodeId)
Stop an started 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.Public public static NMClient createNMClient()
@InterfaceAudience.Public public static NMClient createNMClient(String name)
public abstract Map<String,ByteBuffer> startContainer(Container container, ContainerLaunchContext containerLaunchContext) throws 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
containerYarnException
IOException
public abstract void stopContainer(ContainerId containerId, NodeId nodeId) throws YarnException, IOException
Stop an started container.
containerId
- the Id of the started containernodeId
- the Id of the NodeManager
YarnException
IOException
public abstract ContainerStatus getContainerStatus(ContainerId containerId, NodeId nodeId) throws YarnException, IOException
Query the status of a container.
containerId
- the Id of the started containernodeId
- the Id of the NodeManager
YarnException
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.
Copyright © 2016 Apache Software Foundation. All rights reserved.