https://pantsbuild.org/ logo
#general
Title
# general
p

plain-sundown-25537

04/08/2021, 11:15 PM
Hello guys - I have a question about PEX and venv. If I have a PEX and I have a running process - how to drop my process into the venv created with the PEX. Sorry for my ambiguous question here - in the context, I want see a way to allow each worker of ray (process) drop in a venv of a PEX to start an execution.
e

enough-analyst-54434

04/09/2021, 12:16 AM
Can you clarify "drop". Do you want to somehow move an already started process into a venv or do you get to start processes here?
Maybe easier @plain-sundown-25537 can you answer how you run ray in a way you like / works not using PEX? It may be easiest to work backwards from there.
Better @plain-sundown-25537 do you have evidence this is not happening already? If I modify https://github.com/leozc/fp20/blob/main/ray_demo/rayburst.py and add a print to sys.stderr of sys.executable and sys.path, that shows the actor has the venv as its environment:
Copy code
...
(pid=110701) Running under /home/jsirois/.pex/venvs/short/83a31d7a/bin/python3.8 with sys.path=['/home/jsirois/.pex/venvs/short/83a31d7a/lib/python3.8/site-packages/ray/thirdparty_files', '/home/jsirois/dev/pantsbuild/jsirois-pants', '/home/jsirois/dev/pantsbuild/jsirois-pants', '/home/jsirois/.pex/venvs/short/83a31d7a/lib/python3.8/site-packages/ray/pickle5_files', '/home/jsirois/.pex/venvs/099fb3c816c70b4dabd921c61115573dad7dd99b/d5767e685dbef4a14bc0dc7c7db17006f71d3e96/lib/python3.8/site-packages/ray/workers', '/usr/lib/python38.zip', '/usr/lib/python3.8', '/usr/lib/python3.8/lib-dynload', '/home/jsirois/.pex/venvs/short/83a31d7a/lib/python3.8/site-packages']
[(19, True), (19, True), (19, True), (19, True), (19, True), (19, True), (19, True), (19, True), (19, True), (19, True)]
(pid=110566) Running under /home/jsirois/.pex/venvs/short/83a31d7a/bin/python3.8 with sys.path=['/home/jsirois/.pex/venvs/short/83a31d7a/lib/python3.8/site-packages/ray/thirdparty_files', '/home/jsirois/dev/pantsbuild/jsirois-pants', '/home/jsirois/dev/pantsbuild/jsirois-pants', '/home/jsirois/.pex/venvs/short/83a31d7a/lib/python3.8/site-packages/ray/pickle5_files', '/home/jsirois/.pex/venvs/099fb3c816c70b4dabd921c61115573dad7dd99b/d5767e685dbef4a14bc0dc7c7db17006f71d3e96/lib/python3.8/site-packages/ray/workers', '/usr/lib/python38.zip', '/usr/lib/python3.8', '/usr/lib/python3.8/lib-dynload', '/home/jsirois/.pex/venvs/short/83a31d7a/lib/python3.8/site-packages']
...
p

plain-sundown-25537

04/09/2021, 2:59 AM
@enough-analyst-54434 it is working on local cluster mode - if the workers are deployed on another machine (or different parent process), this won’t work, as expected, other worker on diff process won’t have the venv
Let me give an example repro
Btw it is not pex nor pants problem - I asked since I want to help ray
e

enough-analyst-54434

04/09/2021, 3:26 AM
Does ray deal with this for the jvm? IE do they allow you to configure a jar or list of jars to ship around? If not, then it sounds like they generally leave it up to you to configure all machines identically. If so, then it should be quite similar to add support for shipping PEXes around.
4 Views