Use RAY_ADDRESS to connect to an existing Ray cluster if present - #7977
Conversation
|
Can one of the admins verify this patch? |
|
Test PASSed. |
|
Test PASSed. |
|
Test PASSed. |
|
Test PASSed. |
|
Test PASSed. |
|
Test FAILed. |
edoakes
left a comment
There was a problem hiding this comment.
LGTM! I don't think we need to print a warning if connecting. It seems uncommon for a user to want to start a local cluster when there's one already running on the machine anyways. If there isn't and RAY_ADDRESS is picked up, it will fail anyways.
Why are these changes needed?
We would like to allow people to run existing Ray applications on a cluster without changing their code. This means if they use a driver that is initialized with
ray.init(), there should be a way to make it connect to an existing cluster instead of starting a new one. This can make it more robust to execute Ray applications, i.e. it can force connecting to an existing cluster and avoid the possible problem where somebody runs an application that starts a new local Ray instead of using the existing cluster.This PR makes that possible by introducing an environment variable
RAY_ADDRESS. If it is defined while the driver is run, it will be treated as theaddressparameter ofray.init, making it connect to the existing cluster.Q & A:
RAY_ADDRESSvariable is set and we connect to an existing cluster?In general it is not common practice to print a warning if an environment variable is picked up, but in this case there could be a case for it, especially since warnings can be turned off selectively. On the other hand, if
RAY_ADDRESSis set, using the existing cluster should be the expected behaviour.RAY_ADDRESSis defined?This seems like a rare use case and it is already supported by doing
So I'd avoid complicating the API for this.
Related issue number
Checks
scripts/format.shto lint the changes in this PR.