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

Peter Bacsko commented on YARN-9477:
------------------------------------

Note that this part is the heart of the improvement:

{code}
Pointer sysPathPtr = libUdev.udev_device_get_syspath(device);
{code}

We need the {{sysPath}} to determine where the file {{os_state}} is. Reading 
the Python script provided by NEC, the following happens:
- Get the {{veslot}} device files under {{/dev}} like {{/dev/veslot0}}
- Get the device object from udev (we know the major/minor of the device file 
-> convert it to a device number (like {{os.makedev()}} in Python))
- Get the syspath using libudev for a particular device file
- Get the PCI bus slot using libudev
- Read the {{<syspath>/os_state}} file to determine the status of the card

Note that the PCI bus slot is optional, we don't need that (although we can 
retrieve it too) to construct the device object.

> Implement VE discovery using libudev
> ------------------------------------
>
>                 Key: YARN-9477
>                 URL: https://issues.apache.org/jira/browse/YARN-9477
>             Project: Hadoop YARN
>          Issue Type: Sub-task
>            Reporter: Peter Bacsko
>            Assignee: Peter Bacsko
>            Priority: Major
>         Attachments: YARN-9477-POC.patch
>
>
> Right now we have a Python script which is able to discover VE cards using 
> pyudev: https://pyudev.readthedocs.io/en/latest/
> Java does not officially support libudev. There are some projects on Github 
> (example: https://github.com/Zubnix/udev-java-bindings) but they're not 
> available as Maven artifacts.
> However it's not that difficult to create a minimal layer around libudev 
> using JNA. We don't have to wrap every function, we need to call 4-5 methods.



--
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