public interface ResourcePlugin
ResourcePlugin
is an interface for node manager to easier support
discovery/manage/isolation for new resource types.
It has two major part: createResourceHandler(Context,
CGroupsHandler, PrivilegedOperationExecutor)
and
getNodeResourceHandlerInstance()
, see javadocs below
for more details.
Modifier and Type | Method and Description |
---|---|
void |
cleanup()
Do cleanup of the plugin, this will be invoked when
NodeManager stops |
ResourceHandler |
createResourceHandler(Context nmContext,
CGroupsHandler cGroupsHandler,
PrivilegedOperationExecutor privilegedOperationExecutor)
Plugin needs to return
ResourceHandler when any special isolation
required for the resource type. |
DockerCommandPlugin |
getDockerCommandPluginInstance()
Plugin need to get
DockerCommandPlugin . |
NMResourceInfo |
getNMResourceInfo()
Get resource information from this plugin.
|
NodeResourceUpdaterPlugin |
getNodeResourceHandlerInstance()
Plugin needs to return
NodeResourceUpdaterPlugin when any discovery
mechanism required for the resource type. |
void |
initialize(Context context)
Initialize the plugin, this will be invoked during NM startup.
|
void initialize(Context context) throws org.apache.hadoop.yarn.exceptions.YarnException
context
- NM Contextorg.apache.hadoop.yarn.exceptions.YarnException
- when any issue occursResourceHandler createResourceHandler(Context nmContext, CGroupsHandler cGroupsHandler, PrivilegedOperationExecutor privilegedOperationExecutor)
ResourceHandler
when any special isolation
required for the resource type. This will be added to
ResourceHandlerChain
during NodeManager startup. When no special
isolation need, return null.nmContext
- NodeManager context.cGroupsHandler
- CGroupsHandlerprivilegedOperationExecutor
- Privileged Operation Executor.NodeResourceUpdaterPlugin getNodeResourceHandlerInstance()
NodeResourceUpdaterPlugin
when any discovery
mechanism required for the resource type. For example, if we want to set
resource-value during NM registration or send update during NM-RM heartbeat
We can implement a NodeResourceUpdaterPlugin
and update fields of
NodeHeartbeatRequest
or RegisterNodeManagerRequest
This will be invoked during every node status update or node registration,
please avoid creating new instance every time.void cleanup() throws org.apache.hadoop.yarn.exceptions.YarnException
NodeManager
stopsorg.apache.hadoop.yarn.exceptions.YarnException
- if any issue occursDockerCommandPlugin getDockerCommandPluginInstance()
DockerCommandPlugin
. This will be invoked by
DockerLinuxContainerRuntime
when execute docker commands such as
run/stop/pull, etc.NMResourceInfo getNMResourceInfo() throws org.apache.hadoop.yarn.exceptions.YarnException
GpuDeviceInformation
org.apache.hadoop.yarn.exceptions.YarnException
- when any issue occursCopyright © 2008–2023 Apache Software Foundation. All rights reserved.