Reach client dasboard url in jupyterhub

Hi there,
I have appreciated using the client dashboard on a local computer. But after having installed dask and distributed in a jupyterhub server it seems very hard to get to know the real dashboard url. I was wondering if installing dask jupyterlab extension would help also in jupyterhub for retrieving the client dashboardurl?

I have been trying the folliwing plus more, but no success in opening the dashboard in the jupyterhub yet I am afraid:

import dask
import os
JUPYTERHUB_SERVICE_PREFIX = os.environ['JUPYTERHUB_SERVICE_PREFIX'].rstrip('/')
dask.config.config.get('distributed').get('dashboard').update({'link':f'{JUPYTERHUB_SERVICE_PREFIX}/proxy/{{port}}/status'})
client.dashboard_link

I am adding a bit more code here to make the issue reproducible in jupyterhub:

import dask
import os
import panel as pn
from distributed import Client
from IPython.display import IFrame, display, HTML, Markdown

pn.extension()

client = Client()
JUPYTERHUB_SERVICE_PREFIX = os.environ['JUPYTERHUB_SERVICE_PREFIX'].rstrip('/')
dask.config.config.get('distributed').get('dashboard').update({'link':f'{JUPYTERHUB_SERVICE_PREFIX}/proxy/{{port}}/status'})

pn.Column(pn.pane.Markdown('## Dashboard dask processing'),
          client,
          pn.pane.HTML(IFrame(src=client.dashboard_link, width=1400, height=500), align='center'))

This gives me a 404 error

I am still wondering if dask jupyterlab extension would help in jupyterhub too to make the dashboard reachable?

Hi @geoviz,

On a Jupyterhub, if you have no way to setup in your home environment or make an admin setup on every notebook local environment, I typically use:

dask.config.set({"distributed.dashboard.link": "{JUPYTERHUB_SERVICE_PREFIX}proxy/{port}/status"})

However, for this to work, you need to have jupyter-server-proxy setup on the Jupyterlab environment (or Jupyterhub environment? I’m not sure).

Permanent configuration in Dask config files is documented in dask-jobqueue here.

I was wondering if installing dask jupyterlab extension would help also in jupyterhub for retrieving the client dashboardurl?

No, this extension will help you to visualize parts of the Dashboard directly in Jupyterlab! But you’ll need the correct URL first.