Skip to content

Commit

Permalink
Refactor and setup to always test jupyter-server-proxy
Browse files Browse the repository at this point in the history
  • Loading branch information
milesgranger committed Feb 27, 2024
1 parent 0874a9b commit 4ad2bba
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 26 deletions.
1 change: 1 addition & 0 deletions continuous_integration/environment-3.10.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ dependencies:
- ipykernel
- ipywidgets
- jinja2
- jupyter-server-proxy
- locket
- msgpack-python
- netcdf4
Expand Down
1 change: 1 addition & 0 deletions continuous_integration/environment-3.11.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ dependencies:
- ipykernel
- ipywidgets
- jinja2
- jupyter-server-proxy
- locket
- msgpack-python
- netcdf4
Expand Down
1 change: 1 addition & 0 deletions continuous_integration/environment-3.12.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ dependencies:
- ipykernel
- ipywidgets
- jinja2
- jupyter-server-proxy
- locket
- msgpack-python
- netcdf4
Expand Down
1 change: 1 addition & 0 deletions continuous_integration/environment-3.9.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ dependencies:
- ipykernel
- ipywidgets
- jinja2
- jupyter-server-proxy
- locket
- lz4 # Only tested here
- msgpack-python
Expand Down
43 changes: 17 additions & 26 deletions distributed/cli/tests/test_dask_worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -485,38 +485,29 @@ def func(dask_worker):


@pytest.mark.slow
@gen_cluster(
client=True, nthreads=[], scheduler_kwargs={"dashboard_address": "localhost:8787"}
)
async def test_dashboard_non_standard_ports(c, s, requires_default_ports):
def test_dashboard_non_standard_ports():
pytest.importorskip("bokeh")
requests = pytest.importorskip("requests")

try:
import jupyter_server_proxy # noqa: F401
host = "127.0.0.1"
s_port = "3233"
s_dashboard_port = "3232"
w_dashboard_port = "4833"
s_cmd = f"dask scheduler --host {host} --port {s_port} --dashboard-address :{s_dashboard_port}"
w_cmd = f"dask worker {host}:{s_port} --dashboard-address :{w_dashboard_port} --host {host}"

proxy_exists = True
except ImportError:
proxy_exists = False
with popen(s_cmd.split()):
with popen(w_cmd.split()):
with Client(f"{host}:{s_port}") as c:
c.wait_for_workers(1)

with popen(
[
"dask",
"worker",
s.address,
"--dashboard-address",
":4833",
"--host",
"127.0.0.1",
]
):
await c.wait_for_workers(1)
response = requests.get(f"http://{host}:{w_dashboard_port}/status")
response.raise_for_status()

response = requests.get("http://127.0.0.1:4833/status")
response.raise_for_status()
# TEST PROXYING WORKS
if proxy_exists:
response = requests.get("http://127.0.0.1:8787/proxy/4833/127.0.0.1/status")
# TEST PROXYING WORKS
response = requests.get(
f"http://{host}:{s_dashboard_port}/proxy/{w_dashboard_port}/{host}/status"
)
response.raise_for_status()

with pytest.raises(requests.ConnectionError):
Expand Down

0 comments on commit 4ad2bba

Please sign in to comment.