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

[Autoscaler] Ensure ubuntu is owner of docker host mount folder #13579

Merged
merged 3 commits into from
Jan 22, 2021

Conversation

nikitavemuri
Copy link
Contributor

@nikitavemuri nikitavemuri commented Jan 20, 2021

Why are these changes needed?

Problem: The docker host mount folder is sometimes created with root as the owner. Later, rsync_up is run as part of the session startup with ubuntu as the user. This leads to an error because it cannot write to the folder.

rsync: failed to set times on "/tmp/ray_tmp_mount/anyscale-dev-prod-ecd59fe03a481195/home/ray/test_anyscale_up_2021-01-20-00-11-47-612669_new_up/.": Operation not permitted (1)
./
.anyscale.yaml
session-default.yaml
rsync: mkstemp "/tmp/ray_tmp_mount/anyscale-dev-prod-ecd59fe03a481195/home/ray/test_anyscale_up_2021-01-20-00-11-47-612669_new_up/.anyscale.yaml.01i2l3" failed: Permission denied (13)
rsync: mkstemp "/tmp/ray_tmp_mount/anyscale-dev-prod-ecd59fe03a481195/home/ray/test_anyscale_up_2021-01-20-00-11-47-612669_new_up/.session-default.yaml.HX8zA0" failed: Permission denied (13)

Solution: It seems this folder is only being created in run_rsync_up and run_rsync_down so this PR is changing the ownership of the folder to ubuntu.

  • If the folder already exists and the owner is ubuntu, no ownership will be changed and no errors will be raised.
  • If the folder already exists and the owner is root, this will fail unless the user is also root. This may affect clusters that have already been created. However, it should be ok if this fails because rsync will likely not work on these clusters unless the user running rsync is root.
  • If the folder doesn't already exist and the user is ubuntu, the folder will be created with the owner as ubuntu.
  • If the folder doesn't already exist and the user is root, the folder will be created with the owner as root, but the owner will immediately be changed to ubuntu. Because root is the user, this shouldn't throw an error and would allow rsync to work in the future during session startup.

Related issue number

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

self.ssh_command_runner.run(
f"mkdir -p {os.path.dirname(host_destination.rstrip('/'))}",
f"mkdir -p {host_mount_location} && chown -R ubuntu {host_mount_location}",
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this be hard coded to ubuntu or the auth user in the cluster yaml?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point, it should be the ssh user in the cluster yaml

Copy link
Contributor

@AmeerHajAli AmeerHajAli left a comment

Choose a reason for hiding this comment

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

Lgtm. Left a minor comment.

self.ssh_command_runner.run(
f"mkdir -p {os.path.dirname(host_source.rstrip('/'))}",
f"mkdir -p {host_mount_location} && chown -R ubuntu {host_mount_location}",
Copy link
Contributor

Choose a reason for hiding this comment

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

Same as previous comment.

@nikitavemuri nikitavemuri marked this pull request as ready for review January 21, 2021 03:50
Copy link
Contributor

@AmeerHajAli AmeerHajAli left a comment

Choose a reason for hiding this comment

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

please fix lint:

Thu Jan 21 00:29:42 UTC 2021 Flake8....
python/ray/autoscaler/_private/command_runner.py:635:71: Q000 Remove bad quotes
python/ray/autoscaler/_private/command_runner.py:660:66: Q000 Remove bad quotes

@AmeerHajAli
Copy link
Contributor

@ericl please merge.

@ericl ericl merged commit 4e01a9e into master Jan 22, 2021
@ericl ericl deleted the host_mount_permissions branch January 22, 2021 01:01
fishbone pushed a commit to fishbone/ray that referenced this pull request Feb 16, 2021
…project#13579)

* change ownership to ubuntu if root

* use ssh user in cluster config

* formatting

Co-authored-by: Nikita Vemuri <[email protected]>
fishbone added a commit to fishbone/ray that referenced this pull request Feb 16, 2021
fishbone added a commit to fishbone/ray that referenced this pull request Feb 16, 2021
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.

3 participants