How to get address of existing Ray redis cluster?

Viewed 685

Im writing a flask app that uses Ray. Im trying to just run ray.init() once when the app is started up and then reference that cluster when actually using ray in other files. From the docs it looks like I need to run ray.init(address="") before I can use ray but how do I programmatically get or pass the existing ray cluster's address after running ray.init() the first time? Also, if this is not the right approach in general, please recommend a better design.

2 Answers

ray.init(address="auto") should work. If you need to run ray.init "after running init the first time", you can run ray.shutdown() and then ray.init(address="auto").

The solution I went with is

if ray.is_initialized() == False: ray.init()

Related