Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions distributed/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,12 @@
from contextlib import contextmanager, suppress
from contextvars import ContextVar
from functools import partial
from importlib.metadata import PackageNotFoundError, version
from numbers import Number
from queue import Queue as pyQueue
from typing import Any, ClassVar, Coroutine, Literal, Sequence, TypedDict

from packaging.version import parse as parse_version
from tlz import first, groupby, keymap, merge, partition_all, valmap

import dask
Expand Down Expand Up @@ -1145,6 +1147,12 @@ def __repr__(self):
return f"<{self.__class__.__name__}: No scheduler connected>"

def _repr_html_(self):
try:
dle_version = parse_version(version("dask-labextension"))
JUPYTERLAB = False if dle_version < parse_version("6.0.0") else True
except PackageNotFoundError:
JUPYTERLAB = False

scheduler, info = self._get_scheduler_info()

return get_template("client.html.j2").render(
Expand All @@ -1154,6 +1162,7 @@ def _repr_html_(self):
cluster=self.cluster,
scheduler_file=self.scheduler_file,
dashboard_link=self.dashboard_link,
jupyterlab=JUPYTERLAB,
)

def start(self, **kwargs):
Expand Down
6 changes: 6 additions & 0 deletions distributed/widgets/templates/client.html.j2
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@

</table>

{% if jupyterlab %}
<button style="margin-bottom: 12px;" data-commandlinker-command="dask:populate-and-launch-layout" data-commandlinker-args='{"url": "{{ dashboard_link }}" }'>
Launch dashboard in JupyterLab
</button>
{% endif %}

{% if scheduler is none %}
<p>No scheduler connected.</p>
{% elif cluster %}
Expand Down