java.lang.Object
org.apache.hadoop.yarn.server.nodemanager.containermanager.resourceplugin.gpu.GpuResourcePlugin
All Implemented Interfaces:
ResourcePlugin

public class GpuResourcePlugin extends Object implements ResourcePlugin
  • Field Details

    • MAX_REPEATED_ERROR_ALLOWED

      public static final int MAX_REPEATED_ERROR_ALLOWED
      See Also:
  • Constructor Details

  • Method Details

    • initialize

      public void initialize(Context context) throws org.apache.hadoop.yarn.exceptions.YarnException
      Description copied from interface: ResourcePlugin
      Initialize the plugin, this will be invoked during NM startup.
      Specified by:
      initialize in interface ResourcePlugin
      Parameters:
      context - NM Context
      Throws:
      org.apache.hadoop.yarn.exceptions.YarnException - when any issue occurs
    • createResourceHandler

      public ResourceHandler createResourceHandler(Context context, CGroupsHandler cGroupsHandler, PrivilegedOperationExecutor privilegedOperationExecutor)
      Description copied from interface: ResourcePlugin
      Plugin needs to return 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.
      Specified by:
      createResourceHandler in interface ResourcePlugin
      Parameters:
      context - NodeManager context.
      cGroupsHandler - CGroupsHandler
      privilegedOperationExecutor - Privileged Operation Executor.
      Returns:
      ResourceHandler
    • getNodeResourceHandlerInstance

      public NodeResourceUpdaterPlugin getNodeResourceHandlerInstance()
      Description copied from interface: ResourcePlugin
      Plugin needs to return 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.
      Specified by:
      getNodeResourceHandlerInstance in interface ResourcePlugin
      Returns:
      NodeResourceUpdaterPlugin, could be null when no discovery needed.
    • cleanup

      public void cleanup() throws org.apache.hadoop.yarn.exceptions.YarnException
      Description copied from interface: ResourcePlugin
      Do cleanup of the plugin, this will be invoked when NodeManager stops
      Specified by:
      cleanup in interface ResourcePlugin
      Throws:
      org.apache.hadoop.yarn.exceptions.YarnException - if any issue occurs
    • getDockerCommandPluginInstance

      public DockerCommandPlugin getDockerCommandPluginInstance()
      Description copied from interface: ResourcePlugin
      Plugin need to get DockerCommandPlugin. This will be invoked by DockerLinuxContainerRuntime when execute docker commands such as run/stop/pull, etc.
      Specified by:
      getDockerCommandPluginInstance in interface ResourcePlugin
      Returns:
      DockerCommandPlugin instance. return null if plugin doesn't have requirement to update docker command.
    • getNMResourceInfo

      public NMResourceInfo getNMResourceInfo() throws org.apache.hadoop.yarn.exceptions.YarnException
      Description copied from interface: ResourcePlugin
      Get resource information from this plugin.
      Specified by:
      getNMResourceInfo in interface ResourcePlugin
      Returns:
      NMResourceInfo, an example is GpuDeviceInformation
      Throws:
      org.apache.hadoop.yarn.exceptions.YarnException - when any issue occurs
    • toString

      public String toString()
      Overrides:
      toString in class Object