[ 
https://issues.apache.org/jira/browse/YARN-8851?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16660804#comment-16660804
 ] 

Zhankun Tang commented on YARN-8851:
------------------------------------

[~leftnoteasy], Agree and updated the patch. Please review:
1. Change one API of DevicePlugin:
Added a runtime parameter of the API as below.
{code:java}
  /**
   * Asking how these devices should be prepared/used before container launch.
   * @param allocatedDevices A set of allocated {@link Device}.
   *        Note that it could be null which means no device allocated.
   *        Only {@code volumeClaims} in it will be handled to create volume.
   * @param runtime Indicate which runtime the framework will use
   *        Could be {@code RUNTIME_CGROUPS} or {@code RUNTIME_DOCKER}
   *        in {@link DeviceRuntimeSpec}
   * @return a {@link DeviceRuntimeSpec} description about environment,
   * {@link VolumeSpec}, {@link MountVolumeSpec}. etc
   * */
DeviceRuntimeSpec onDevicesUse(Set<Device> allocatedDevices, String runtime);
{code}
2. Added some code to show how to get DeviceRuntimeSpec and use it.
The above onDevicesUse is called in ResourceHandler's preStart and 
DockerCommandPlugin's all three methods. Because DockerCommanPlugin's 
getCreateDockerVolumeCommand method is called before ResourceHandler's preStart 
if runtime is Docker. So here the allocatedDevices would be null to pass in. 
The code here let the device plugin return DeviceRuntimeSpec with only 
VolumeSpec in it which requires YARN to create docker volume. Or it can return 
an empty object if it can create in its own way. Then YARN does nothing for the 
docker volume creation.

This above API might be a little complex. And we can also add one interface 
like below. But I'm not quite sure if the two "onDevicePreparation" and 
"onDeviceUse" would cause confusion.

In theory, we can change our internals to make the allocation earlier and 
visible to DockerCommandPlugin. In that way, the allocation will not be null 
and the onDeviceUse seems clear.  So I don't add one. 
{code:java}
VolumeSpec onDevicePreparation(String runtime)
{code}

Please let me know your thoughts. Thanks.

> [Umbrella] A new pluggable device plugin framework to ease vendor plugin 
> development
> ------------------------------------------------------------------------------------
>
>                 Key: YARN-8851
>                 URL: https://issues.apache.org/jira/browse/YARN-8851
>             Project: Hadoop YARN
>          Issue Type: New Feature
>          Components: yarn
>            Reporter: Zhankun Tang
>            Assignee: Zhankun Tang
>            Priority: Major
>         Attachments: YARN-8851-WIP2-trunk.001.patch, 
> YARN-8851-WIP3-trunk.001.patch, YARN-8851-WIP4-trunk.001.patch, 
> YARN-8851-WIP5-trunk.001.patch, YARN-8851-WIP6-trunk.001.patch, 
> YARN-8851-WIP7-trunk.001.patch, [YARN-8851] 
> YARN_New_Device_Plugin_Framework_Design_Proposal-3.pdf, [YARN-8851] 
> YARN_New_Device_Plugin_Framework_Design_Proposal.pdf
>
>
> At present, we support GPU/FPGA device in YARN through a native, coupling 
> way. But it's difficult for a vendor to implement such a device plugin 
> because the developer needs much knowledge of YARN internals. And this brings 
> burden to the community to maintain both YARN core and vendor-specific code.
> Here we propose a new device plugin framework to ease vendor device plugin 
> development and provide a more flexible way to integrate with YARN NM.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: yarn-issues-unsubscr...@hadoop.apache.org
For additional commands, e-mail: yarn-issues-h...@hadoop.apache.org

Reply via email to