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] Update replica ID format (and other random strings) to better match UUIDs #41737

Merged
merged 3 commits into from
Dec 8, 2023

Conversation

edoakes
Copy link
Contributor

@edoakes edoakes commented Dec 8, 2023

Why are these changes needed?

Small cosmetic update to our replica ID generation to make it use the same alphabet as UUID (which is standard and we use for request IDs).

Related issue number

Checks

  • I've signed off every commit(by using the -s flag, i.e., git commit -s) in this PR.
  • 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 added any new APIs to the API Reference. For example, if I added a
      method in Tune, I've added it in doc/source/tune/api/ under the
      corresponding .rst file.
  • 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 :(

Signed-off-by: Edward Oakes <ed.nmi.oakes@gmail.com>
@edoakes edoakes requested a review from a team December 8, 2023 17:03
@@ -614,7 +614,7 @@ def shutdown(self):
and proxy_state_is_shutdown
):
logger.warning(
"All resources have shut down, shutting down controller!",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@GeneDer reminder to mostly avoid exclamation points in log messages (and other technical writing)

Copy link
Contributor

Choose a reason for hiding this comment

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

will do👍

Signed-off-by: Edward Oakes <ed.nmi.oakes@gmail.com>
Copy link
Contributor

@GeneDer GeneDer left a comment

Choose a reason for hiding this comment

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

:shipit:

def get_random_letters(length=6):
return "".join(random.choices(string.ascii_letters, k=length))
# Match the standard alphabet used for UUIDs.
RANDOM_STRING_ALPHABET = string.ascii_lowercase + string.digits
Copy link
Contributor

Choose a reason for hiding this comment

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

Non-blocker: A bit nit, since we now allows digits, maybe can name it RANDOM_STRING_ALPHANUMERIC instead? 🙃

Copy link
Contributor

Choose a reason for hiding this comment

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

Also kinda after thought, there is also a UUID module in python not sure if we want to consider using that

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes we use UUID elsewhere but here the length of the UUID is overkill and will degrade the UX for reading logs (replica IDs are scoped to a single deployment in a single cluster)

Signed-off-by: Edward Oakes <ed.nmi.oakes@gmail.com>
@edoakes edoakes merged commit f783234 into ray-project:master Dec 8, 2023
14 of 15 checks passed
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.

4 participants