Uploaded image for project: 'Hadoop YARN'
  1. Hadoop YARN
  2. YARN-8851 [Umbrella] A pluggable device plugin framework to ease vendor plugin development
  3. YARN-8989

Move DockerCommandPlugin volume related APIs' invocation from DockerLinuxContainerRuntime#prepareContainer to #launchContainer

    XMLWordPrintableJSON

Details

    • Sub-task
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 3.3.0
    • None
    • None
    • Reviewed

    Description

      This seems required before we implement isolation in pluggable device framework for default container and Docker container with LinuxContainerExecutor.

      To find a place for plugin "onDevicesAllocated" in current operation flow when running a container with LCE.

      ContainerLaunch#call() ->
          1.ContainerLaunch#prepareContainer() - >
                LCE#prepareContainer ->
                       DelegatingLinuxContainerRuntime#prepareContainer ->
                            DockerLinuxContainerRuntime#prepareContainer ->
                                  DockerCommandPlugin#getCreateDockerVolumeCommand ->
                                  onDeviceAllocated(null,docker); create volume? 
       
           2.ContainerLaunch#launchContainer
                 LCE#launchContainer() ->
                      resourceHandlerChain#preStart() ->
                            DeviceResourceHandlerImpl#preStart() ->
                                   onDeviceAllocated(alloc,docker)
      allocate device and do isolation for default container with cgroup
      

       

      What I want to do here is to move the DockerCommandPlugin APIs invocation from DockerLinuxContainerRuntime#prepareContainer to #launchContainer. This won't bring any incompatibility and can benefit the pluggable device framework's interaction with the device plugin.

      The "DeviceRuntimeSpec onDevicesAllocated(Set<Device>allocation, yarnRuntime)" implemented by device plugin is to let the plugin do some preparation and return a spec on how to run the container with the allocated device. We designed a VolumeClaim field in DeviceRuntimeSpec object for the plugin to declare what volume they need to create.

      In current code flow, call this "onDevicesAllocated" in the DockerCommandPlugin's methods seems weird and can only pass a null value as allocation. This will complex the vendor device plugin implementation to handle a null value.

      Once we move the DockerCommandPlugin API invocation, it will like this:

      ContainerLaunch#call() ->
           ContainerLaunch#launchContainer
                 LCE#launchContainer() ->
                      resourceHandlerChain#preStart() ->
                            DeviceResourceHandlerImpl#preStart() ->
                                   onDeviceAllocated(alloc,docker)
      allocate device and do isolation for default container with cgroup
      
                      DelegatingLinuxContainerRuntime#launchContaienr ->
                          DockerLinuxContainerRuntime#launchContainer->
                             DockerCommandPlugin#getCreateDockerVolumeCommand ->
      
      get allocation;onDeviceAllocated(alloc,docker);create volume

      After changes, the flow is more smooth and also simplify the plugin implementation for "onDevicesAllocated"

      Attachments

        1. YARN-8989-trunk-001.patch
          6 kB
          Zhankun Tang

        Activity

          People

            tangzhankun Zhankun Tang
            tangzhankun Zhankun Tang
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: