Skip to content

replace os.execvp with subprocess.run - #25546

Closed
mattip wants to merge 1 commit into
ray-project:masterfrom
mattip:os-to-subprocess
Closed

mattip wants to merge 1 commit into
ray-project:masterfrom
mattip:os-to-subprocess

Conversation

@mattip

@mattip mattip commented Jun 7, 2022 •

Copy link
Copy Markdown
Contributor

Why are these changes needed?

The call to os.execvp for starting a worker process is complicated and can be replaced with subprocess.run. This will also solve the problem of paths with spaces in them, since subprocess properly handles them.

Related issue number

Closes #24574

Replaces #25151

Checks

Comment thread python/ray/node.py
setup_worker_path=os.path.join(
os.path.dirname(os.path.abspath(__file__)),
f"workers/{ray_constants.SETUP_WORKER_FILENAME}",
"workers", f"{ray_constants.SETUP_WORKER_FILENAME}",

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This fixes the / for windows by using os.path.join with multiple arguments. The previous code worked, but looks strange in debug logs

if child_pid == 0:
# child process
os.execvp("bash", ["bash", "-c", command_str])
subprocess.run(command_args)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make this work as it does in the unmocked code

@DmitriGekhtman

Copy link
Copy Markdown
Contributor

@pcmoritz could you pass this on for review by the Ray/windows experts

@mattip
mattip marked this pull request as draft June 12, 2022 08:39
@mattip

mattip commented Jun 16, 2022

Copy link
Copy Markdown
Contributor Author

Closing. Replaced by #25659

@mattip mattip closed this Jun 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Ray cannot find Python.exe because of spaces in path<Ray component: Core|RLlib|etc...>]

3 participants