public class DevicePluginAdapter extends Object implements ResourcePlugin
DevicePluginAdapter
will adapt existing hooks.
into vendor plugin's logic.
It decouples the vendor plugin from YARN's device frameworkConstructor and Description |
---|
DevicePluginAdapter(String name,
DevicePlugin dp,
DeviceMappingManager dmm) |
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. |
DeviceMappingManager |
getDeviceMappingManager() |
DevicePlugin |
getDevicePlugin() |
DeviceResourceHandlerImpl |
getDeviceResourceHandler() |
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 |
setDeviceResourceHandler(DeviceResourceHandlerImpl deviceResourceHandler) |
String |
toString() |
public DevicePluginAdapter(String name, DevicePlugin dp, DeviceMappingManager dmm)
public void setDeviceResourceHandler(DeviceResourceHandlerImpl deviceResourceHandler)
public DeviceMappingManager getDeviceMappingManager()
public DevicePlugin getDevicePlugin()
public void initialize(Context context) throws org.apache.hadoop.yarn.exceptions.YarnException
ResourcePlugin
initialize
in interface ResourcePlugin
context
- NM Contextorg.apache.hadoop.yarn.exceptions.YarnException
- when any issue occurspublic ResourceHandler createResourceHandler(Context nmContext, CGroupsHandler cGroupsHandler, PrivilegedOperationExecutor privilegedOperationExecutor)
ResourcePlugin
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.createResourceHandler
in interface ResourcePlugin
nmContext
- NodeManager context.cGroupsHandler
- CGroupsHandlerprivilegedOperationExecutor
- Privileged Operation Executor.public NodeResourceUpdaterPlugin getNodeResourceHandlerInstance()
ResourcePlugin
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.getNodeResourceHandlerInstance
in interface ResourcePlugin
public void cleanup()
ResourcePlugin
NodeManager
stopscleanup
in interface ResourcePlugin
public DockerCommandPlugin getDockerCommandPluginInstance()
ResourcePlugin
DockerCommandPlugin
. This will be invoked by
DockerLinuxContainerRuntime
when execute docker commands such as
run/stop/pull, etc.getDockerCommandPluginInstance
in interface ResourcePlugin
public NMResourceInfo getNMResourceInfo() throws org.apache.hadoop.yarn.exceptions.YarnException
ResourcePlugin
getNMResourceInfo
in interface ResourcePlugin
GpuDeviceInformation
org.apache.hadoop.yarn.exceptions.YarnException
- when any issue occurspublic DeviceResourceHandlerImpl getDeviceResourceHandler()
Copyright © 2008–2023 Apache Software Foundation. All rights reserved.