How to access Ray Dashboard from Google Colab

How severe does this issue affect your experience of using Ray?

  • Low: It annoys or frustrates me for a moment.

Please note: I am one elapsed hour into my Ray journey - total newbie.

I am using Google Colab to learn ML, MLOps, etc. I am currently learning about Ray.

My Colab notebook has the following cell:

!pip install -U "ray[data,train,tune,serve]"

which when executed results in (a lot of logging ending in):

Successfully installed aiohttp-cors-0.7.0 colorful-0.5.6 distlib-0.3.8 fastapi-0.110.0 h11-0.14.0 httptools-0.6.1 opencensus-0.11.4 opencensus-context-0.1.3 py-spy-0.3.14 python-dotenv-1.0.1 ray-2.10.0 starlette-0.36.3 tensorboardX-2.6.2.2 uvicorn-0.29.0 uvloop-0.19.0 virtualenv-20.25.1 watchfiles-0.21.0 websockets-12.0

After that I have the following cell:

import ray

if ray.is_initialized():
    ray.shutdown()
ray.init()

which when executed results in output like the following:

2024-03-29 18:26:01,586 INFO worker.py:1743 – Started a local Ray instance. View the dashboard at 127.0.0.1:8265
Python version: 3.10.12
Ray version: 2.10.0
Dashboard: http://127.0.0.1:8265

Now I want to access the Dashboard to explore it, but obviously it is not at http://127.0.0.1:8265.

Please could someone let me know how I can access it, if I can?

I guess you may need to port forward it to your local host somehow?

I think this is more of a colab question? Saw some related posts like this

1 Like

@Huaiwei_Sun that’s brilliant, thanks a lot. That really helped. It lead me to this article about advanced outputs in Colab which gave me the following solution:

from google.colab import output
output.serve_kernel_port_as_window(8265)

which when executed presents a link to the Dashboard.

Thanks again.