Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Serve] [runtime env] Replace os.rename with shutil.move in remove_dir_from_filepaths() #22018

Merged
merged 5 commits into from
Feb 1, 2022

Conversation

shrekris-anyscale
Copy link
Contributor

@shrekris-anyscale shrekris-anyscale commented Feb 1, 2022

Why are these changes needed?

Currently, the remove_dir_from_filepaths() function uses os.rename() when shifting directories and files. This change replaces os.rename() with shutil.move() to support these operations even when the directory's parent and the temporary directory are located on separate file systems.

Related issue number

N/A

Checks

  • I've run scripts/format.sh to lint the changes in this PR.
  • I've included any doc changes needed for https://docs.ray.io/en/master/.
  • I've made sure the tests are passing. Note that there might be a few flaky tests, see the recent failures at https://flakey-tests.ray.io/
  • Testing Strategy
    • Unit tests
    • Release tests
    • This PR is not tested :(

@edoakes
Copy link
Contributor

edoakes commented Feb 1, 2022

@shrekris-anyscale looks like linter is failing. I needed to do pip install black==21.12b0 to get the right version locally for my PRs

@edoakes
Copy link
Contributor

edoakes commented Feb 1, 2022

@shrekris-anyscale any good way to test this? If not, can we at least leave a comment saying why it's important to use shutil?

@shrekris-anyscale
Copy link
Contributor Author

I'm not sure of a way to unit test this cross-file system bug. I added a comment explaining why we should use shutil though.

@edoakes edoakes merged commit 8d43a6b into ray-project:master Feb 1, 2022
smorad pushed a commit to smorad/ray that referenced this pull request Feb 7, 2022
…r_from_filepaths() (ray-project#22018)

Currently, the `remove_dir_from_filepaths()` function uses `os.rename()` when shifting directories and files. This change replaces [`os.rename()`](https://docs.python.org/3/library/os.html#os.rename) with [`shutil.move()`](https://docs.python.org/3/library/shutil.html#shutil.move) to support these operations even when the directory's parent and the temporary directory are located on separate file systems.
simon-mo pushed a commit that referenced this pull request Mar 25, 2022
…r_from_filepaths() (#22018)

Currently, the `remove_dir_from_filepaths()` function uses `os.rename()` when shifting directories and files. This change replaces [`os.rename()`](https://docs.python.org/3/library/os.html#os.rename) with [`shutil.move()`](https://docs.python.org/3/library/shutil.html#shutil.move) to support these operations even when the directory's parent and the temporary directory are located on separate file systems.
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.

2 participants