-
Notifications
You must be signed in to change notification settings - Fork 6.2k
find_redis_address docstring #11884
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
find_redis_address docstring #11884
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.
Good idea, just a comment about naming.
Also, is it possible to only show the relevant parts of the command that we process or do you think showing the full thing verbatim is necessary? Right now it's hard to scan the docstring to understand what I should be looking for.
python/ray/_private/services.py
Outdated
""" | ||
Currently, this extracts the --redis-address from the command that launched |
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.
Let's call this --address
instead of --redis-address
everywhere in the comment (--redis-address
is the deprecated name).
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.
I've added a note that --redis-address
is deprecated, but I think that the fact that this function looks for --redis-address
instead of --address
is literally the most important thing to know about this function, precisely because it's using the deprecated name.
Right now, if something is going wrong and someone comes poking through this code, that --redis-address
sure jumps out, and it's helpful to have something clarifying "If you check ps aux and the command line looks like this, then the problem is not here."
And in the future, when the relevant command lines actually are changed to remove --redis-address
--- I mean, this function is going to inevitably break, right? Because in the actual code it is in fact looking for --redis-address
. So having a warning here might save some time for the poor developer trying to remove --redis-address
.
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.
I didn't actually realize that we hadn't changed --redis-address
internally! This makes sense to me, 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.
Hmm. There are probably three audiences here. The original purpose was just to add an explanation for people poking through the code looking for places to set traps because they suspect some function in here is not returning the correct address. Parsing a cmdline certainly looks fragile, so it draws the eye, so it's nice to have a docstring explaining what this function is doing. But as long as I was adding a docstring, I figured I'd to add a warning for passing developers. Maybe this is just me, but when I see something like this I want to add asserts or something to check everything that's in the line, to be sure we're not pulling out The big long string is to get across just how hard this problem is. (For one thing, there actually is a And the third purpose is for developers who come seeking this function specifically because it has broken, which is probably will sooner or later. (If nothing else, as you note, For that hypothetical where the function isn't working and it's not clear why, it seems worth knowing "So exactly what input did this thing get back when it was working?" |
Why are these changes needed?
Currently,
find_redis_address()
lacks a docstring, and is somewhat complicated and counter-intuitive when reading the code. This adds a specific example of a stringfind_redis_address()
might process.Related issue number
Checks
scripts/format.sh
to lint the changes in this PR.