-
Notifications
You must be signed in to change notification settings - Fork 549
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
[UX] Friendly error message when mounting fails with non-empty mount path #1908
[UX] Friendly error message when mounting fails with non-empty mount path #1908
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @landscapepainter! Left some comments.
sky/backends/cloud_vm_ray_backend.py
Outdated
f' {mount_path} may have been already ' | ||
f'taken by the Kernel. Please set the ' | ||
f'mount path to another name.') | ||
raise exceptions.StorageMountPathError(error_msg) from None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's good to catch exceptions.MOUNT_PATH_NON_EMPTY_CODE
since that's a common case.
What happens if e.returncode != exceptions.MOUNT_PATH_NON_EMPTY_CODE
. We should perhaps add a || echo
like mentioned here, so the error is surfaced nicely instead of the entire heredoc.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With the current implementation, when e.returncode != exceptions.MOUNT_PATH_NON_EMPTY_CODE
(manually setting the exit code of the heredoc to be 99
and MOUNT_PATH_NON_EMPTY_CODE
to be 42
) and attempting to mount to a non-empty directory, it does surface the error message from the heredoc without displaying the entire heredoc : E 05-05 03:11:59 subprocess_utils.py:70] Mount path /tmp is not empty. Please make sure its empty.
Does it still need the || echo
implementation in mounting_utils.py
? If so, what error should it be catching? The only error with an exit code in the heredoc from mounting_utils.py
is when the $MOUNT_PATH
is non-empty, and in this case, it is hard coded that it exits with 42
and echos a error message as well: E 05-05 03:11:59 subprocess_utils.py:70] Mount path /tmp is not empty. Please make sure its empty.
Or perhaps, I misunderstood what you meant. Would you mind elaborating a bit more if this is the case?
@romilbhardwaj Ready for another look :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Quick look at the UX.
sky/data/mounting_utils.py
Outdated
@@ -60,7 +60,7 @@ def get_mounting_command( | |||
# Check if mount path contains files | |||
if [ "$(ls -A $MOUNT_PATH)" ]; then | |||
echo "Mount path $MOUNT_PATH is not empty. Please make sure its empty." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
echo "Mount path $MOUNT_PATH is not empty. Please make sure its empty." | |
echo "Mount path $MOUNT_PATH is not empty. Please mount to another path or remove it first." |
(Suggest a fix for common scenarios first; e.g., if people accidentally mount to /tmp, the first fix should be use another path)
NOTE: I find it confusing that we allow mounting to a /empty-dir
without files. The convention in other tools seems to be if the path exists, regardless of whether files exist, then back off.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated the echo message.
What kind of potential issues can be arised by allowing to mount on existing directories?
@concretevitamin @romilbhardwaj Ready for another look! Thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @landscapepainter! Left some comments. Tried it out and the error is much cleaner now. It also prints the stdout/stderr of the mounting script, which I think is helpful for debugging.
merge master
@romilbhardwaj ready for another look! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work @landscapepainter, thanks!
Works nicely @landscapepainter - one UX observation, with the
|
@concretevitamin Thanks for bringing up those cases: For the gcfuse install log, |
Nit: Maybe we can logger.info() stdout and logger.error() stderr in this case? |
This resolves #1895
When launching a remote VM, there is a chance of the mount path set by the user to be pre-occupied when the path is taken by the kernel (i.e.
/tmp
or/sys
). In such case,sky
raisesCommandError
showing what command caused the error. But in this case, the command is a heredoc which causes the error message to be very long and difficult to interpret. This PR fixes the issue by suppressing the long command raised with CommandError and raises a concise and straightforward message.Before:
After:
Tested (run the relevant ones):
/tmp
, set as mount path/tmp
, set as mount path