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

[Sky Launch] User's workdir name should match Cloud's workdir name #388

Closed
michaelzhiluo opened this issue Feb 20, 2022 · 10 comments
Closed

Comments

@michaelzhiluo
Copy link
Collaborator

If the user's setup script installs their own workdir (such as pip install -e .), the installed packaged will be named sky_workdir because Sky uploads the user's work directory under sky_workdir.

@michaelzhiluo michaelzhiluo changed the title [Sky Launch] User's workdir name should match Cloud's workdir name [Sky Launch] User's workdir name should match Cloud's workdir name Feb 20, 2022
@concretevitamin
Copy link
Member

One fix is to use ~/sky_workdir/<user_workdir_name>. Another is ~/<user_workdir_name>. The former seems better due to some encapsulation.

@romilbhardwaj
Copy link
Collaborator

How about recreating user's exact workdir path? e.g. if workdir is /home/romilb/myproject/mycode, we create the exact same path on remote instead of putting at ~/sky_workdir. This can be a problem if the workdir is some standard path (e.g. /tmp, /bin), but otherwise it allows users to retain absolute paths in their code

@concretevitamin
Copy link
Member

That will encounter permission issues. The file_mounts helper circumvents them by symlinking from under ~/: https://github.com/sky-proj/sky/blob/47e264d9187fdc8702a4a254d85a1a7efa52dd4a/sky/backends/backend_utils.py#L75
I'm leaning towards doing the less complex thing to satisfy user asks at the moment.

@concretevitamin
Copy link
Member

To add, the PR description shows an example of why preserving the workdir name is needed. However, preserving the exact path seems to only be useful if the task's going to traverse the path -- e.g., cd up one level, ls two levels up -- which we can't support because those levels aren't synced. That said, pls push back if this is explicitly requested by Daniel!

@romilbhardwaj
Copy link
Collaborator

romilbhardwaj commented Feb 21, 2022

Hmm, one example case where we need the exact path is it is hardcoded in user code (e.g. f=open('/home/romilb/myproject/mycode/myfile.csv'). Ideally good code shouldn't have such absolute paths, but I sometimes find it in scripts/notebooks I've written in a hurry

That will encounter permission issues

would chown/chmod be sufficient to fix that?

@michaelzhiluo
Copy link
Collaborator Author

+1 with Romil's idea. This aligns with the ultimate goal to make the remote env as similar as possible as to the local env.

@concretevitamin
Copy link
Member

Seems like we should follow Docker's philosophy here. The pattern

WORKDIR /app
COPY . .

is commonly used and advertised. Here, the local workdir is ., which can have a complex path, while the remote workdir location is simply /app.

Guessing they don't imitate the paths because it's a leaky abstraction for the reason mentioned above (what if users "use" parent dirs?), and thus make the container image no longer self-contained.

@Michaelvll Michaelvll added the documentation Improvements or additions to documentation label Feb 22, 2022
@Michaelvll
Copy link
Collaborator

Michaelvll commented Feb 22, 2022

Here are some of the possible solutions for how to deal with the workdir after a discussion with @concretevitamin and @romilbhardwaj , but for now, we can stick with modifying the doc.

@github-actions
Copy link
Contributor

This issue is stale because it has been open 120 days with no activity. Remove stale label or comment or this will be closed in 10 days.

@github-actions github-actions bot added the Stale label May 12, 2023
@github-actions
Copy link
Contributor

This issue was closed because it has been stalled for 10 days with no activity.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale May 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants