-
Notifications
You must be signed in to change notification settings - Fork 503
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
[Core] Relax cluster name restriction and process cloud cluster name #3130
[Core] Relax cluster name restriction and process cloud cluster name #3130
Conversation
Requesting review @Michaelvll |
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 for the fix @dtran24! Looks pretty good to me! Left some comments mostly for code style : )
Appreciate the review @Michaelvll! Is helpful for me as I learn more about the codebase's patterns Also, whenever this PR does get approved, feel free to merge it since I don't have permissions to merge myself |
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 for the quick update @dtran24! We should test a bit of the backward compatibility before merging, i.e., we need to make sure the cluster_name_on_cloud
does not change for existing clusters after making the change for this function.
Did a quick check on backward compatibility
Let me know if something like this is what you had in mind @Michaelvll |
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 for the quick fix @dtran24! Some final comments:
We should update the docstr in the following function, by saying that dot
and underscores are allowed, as we will handle it when mapping to the cluster_name_on_cloud
in common_utils.make_cluster_name_on_cloud
skypilot/sky/utils/common_utils.py
Lines 553 to 574 in d10ec5a
def get_cleaned_username(username: str = '') -> str: | |
"""Cleans the username as some cloud provider have limitation on | |
characters usage such as dot (.) is not allowed in GCP. | |
Clean up includes: | |
1. Making all characters lowercase | |
2. Removing any non-alphanumeric characters (excluding hyphens) | |
3. Removing any numbers and/or hyphens at the start of the username. | |
4. Removing any hyphens at the end of the username | |
e.g. 1SkY-PiLot2- becomes sky-pilot2 | |
Returns: | |
A cleaned username. | |
""" | |
username = username or getpass.getuser() | |
username = username.lower() | |
username = re.sub(r'[^a-z0-9-]', '', username) | |
username = re.sub(r'^[0-9-]+', '', username) | |
username = re.sub(r'-$', '', username) | |
return username | |
PTAL @Michaelvll, appreciate the time and effort for reviewing this multiple times! As per the comment for updating docstr for skypilot/sky/utils/common_utils.py Line 605 in 430ab05
Otherwise, the docstr update didn't seem to make sense to me |
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.
Thank you for the update @dtran24! LGTM. Merging the PR now.
Fixes #2709
Tested (run the relevant ones):
bash format.sh
pytest tests/unit_tests/test_cloud.py::TestCheckClusterNameIsValid
pytest tests/unit_tests/test_common_utils.py
sky launch -c mycluster@ hello_sky.yaml --cloud aws
. Raised exception, as expectedsky launch -c mycluster hello_sky.yaml --cloud aws
sky launch -c Cuda_11.8 hello_sky.yaml --cloud aws
. Processed cluster name, as expected.sky status
displays the original cluster namesky launch -c mycluster@ hello_sky.yaml --cloud aws --use-spot
. Raised exception, as expectedsky launch -c mycluster hello_sky.yaml --cloud aws --use-spot
sky launch -c Cuda_11.8 hello_sky.yaml --cloud aws --use-spot
. Processed cluster name, as expected.sky status
displays the original cluster namepytest tests/test_smoke.py
pytest tests/test_smoke.py::test_fill_in_the_name
bash tests/backward_comaptibility_tests.sh