Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Simplify hosing of Dask Scheduler Dashboard behind the proxy

未关闭
#8,957 0 条评论 1 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
35/100
Issue 类型
功能
描述清晰度
基本清楚
活跃度
停滞
技术栈
kubernetes, python
领域
devops, web-dev

调研方向

首先使用 Client() 或 dask-scheduler --host 0.0.0.0 --dashboard-address 8787 重现 scheduler dashboard,并使用代理前缀 /session/{SID}/ports/{PID}/。阅读 dashboard 路由和生成的 asset URL 处理方式,然后验证重定向、Bokeh asset 和 sortable.js 能否在带前缀的路径下正确解析。

由索引模型根据 Issue 内容生成。

描述

needs triage

I'm trying to get Dask Scheduler running behind a custom reverse proxy.
The proxy does URL rewriting from /session/{SID}/ports/{PID}/* to just /*.

The dask scheduler dashboard is executed inside a Kubernetes pod.

In this setup, Dask Scheduler Dashboard doesn't really easily work out of the box.

Here is a couple of issues I have faced so far.

1. Absolute redirect to the root path

If you just try to open /session/{SID}/ports/{PID}/, the dashboard does a redirect to /status root path which omits the proxy subpath and breaks the target URL redirecting to host.com/status.

2. Bokeh assets are broken

The very next issue when you manually try to manually open the correct status URL e.g. /session/{SID}/ports/{PID}/status is all bokeh assets are broken because they are requested with absolute URL e.g. /static/js/bokeh-gl.min.js?v=ver:

Screenshot 2024-12-05 at 13 30 31

Interestingly, if you run it locally, the path will be relative e.g. static/js/bokeh-gl.min.js?v=ver.

It's possible to work this around by specifying this environment variable: export BOKEH_RESOURCES="cdn" that would effectively try to pull bokeh assets not from the current scheduler server but CDN.

3. Incorrect relative paths for sortable.js

The third problem that I have noticed is wrong relative paths for some assets on some pages. For example, when I open /session/{SID}/ports/{PID}/info/main/workers.html page, it tries to load ../../../statics/js/sortable.min.js that assumes three levels of nesting:

Screenshot 2024-12-05 at 13 39 44   Apparently, there should have been two levels navigation up e.g. `../..` instead of three to reach the root because out full path looks like:
info/main/workers.html
 2     1   we are here^

Three level navigation e.g. ../../.. works okay when you host the Dask Dashboard under the hostname e.g. host.com/info/main/workers.html because you simply cannot leave the root dir, so browser/server correctly handles this case.
However, when you host your app under subpath e.g. /session/{SID}/ports/{PID}/info/main/workers.html it ends up incorrectly navigating to /session/{SID}/ports/statics/js/sortable.min.js instead of /session/{SID}/ports/{PID}/statics/js/sortable.min.js.

Summary

Given all these issues with route building when the Dask Dashboard is hosted under the subpath, could we possibly make it less challenging and easier to get it work in this setup? 🙏

The first issue could be theoretically worked around by rewriting the response redirect header. The workaround for the second issue has been mentioned. As for the third one, there is as much as you can do because it's a part of the generated HTML and broken on the browser level. You could fix this by modifying the underlying content of the page but that's a lot do and support if the proxy is not Dask-specific.

Other Context

I'm installing Dask like this:

pip install "dask[distributed]" bokeh

Then I'm running the dashboard in one of these way:

from dask.distributed import Client

client = Client()
dask-scheduler --host 0.0.0.0 --dashboard-address 8787

The Dask version that I used for testing was 2023.11.0.

There is no Dask or Bokeh specific env vars in my environment.

主要语言
Python
星标
1.7k
派生
780
PR 合并指标
30 天内没有已合并 PR

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

dask/distributed 的其他 Issue

查看 dask/distributed 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。