diff --git a/distributed/http/scheduler/info.py b/distributed/http/scheduler/info.py index 6ca6f5d3b6c..a84a6a362fe 100644 --- a/distributed/http/scheduler/info.py +++ b/distributed/http/scheduler/info.py @@ -11,6 +11,7 @@ from tornado import escape from tornado.websocket import WebSocketHandler +import dask from dask.typing import Key from dask.utils import format_bytes, format_time @@ -32,6 +33,10 @@ logger = logging.getLogger(__name__) +API_ENABLED = "distributed.http.scheduler.api" in dask.config.get( + "distributed.scheduler.http.routes" +) + class Workers(RequestHandler): @log_errors @@ -40,6 +45,7 @@ def get(self): "workers.html", title="Workers", scheduler=self.server, + api_enabled=API_ENABLED, **merge( self.server.__dict__, self.server.__pdict__, @@ -62,6 +68,7 @@ def get(self, worker): "worker.html", title="Worker: " + worker, scheduler=self.server, + api_enabled=API_ENABLED, Worker=worker, **merge( self.server.__dict__, @@ -134,6 +141,7 @@ def get(self, task: str) -> None: title=f"Task: {key!r}", Task=key, scheduler=self.server, + api_enabled=API_ENABLED, **merge( self.server.__dict__, self.server.__pdict__, diff --git a/distributed/http/templates/worker-table.html b/distributed/http/templates/worker-table.html index 1f7168c3381..2ab60951fa2 100644 --- a/distributed/http/templates/worker-table.html +++ b/distributed/http/templates/worker-table.html @@ -12,6 +12,10 @@ Services Logs Last seen + {% if api_enabled %} + + {% else %} + {% end %} @@ -33,7 +37,40 @@ {% end %} logs {{ format_time(time() - ws.last_seen) }} + {% if api_enabled %} + +
+ +
+ + {% else %} + {% end %} {% end %} + +