From 138c827fb92136dd18fc2acff30a1f0a4b4c760c Mon Sep 17 00:00:00 2001 From: Benjamin Zaitlen Date: Fri, 3 Jun 2022 13:46:18 -0400 Subject: [PATCH 1/3] try fixing scheduler dashboard tests by waiting just a bit/asserting scheduler is up before creating client --- distributed/cli/tests/test_dask_scheduler.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/distributed/cli/tests/test_dask_scheduler.py b/distributed/cli/tests/test_dask_scheduler.py index 308ee86a011..658f01af820 100644 --- a/distributed/cli/tests/test_dask_scheduler.py +++ b/distributed/cli/tests/test_dask_scheduler.py @@ -101,6 +101,7 @@ def test_dashboard_non_standard_ports(loop): with popen( ["dask-scheduler", "--port", "3448", "--dashboard-address", ":4832"] ) as proc: + line = wait_for_log_line(b"dashboard at", proc.stdout) with Client("127.0.0.1:3448", loop=loop) as c: pass @@ -208,7 +209,8 @@ def test_scheduler_port_zero(loop): with tmpfile() as fn: with popen( ["dask-scheduler", "--no-dashboard", "--scheduler-file", fn, "--port", "0"] - ): + ) as proc: + line = wait_for_log_line(b"dashboard at", proc.stdout) with Client(scheduler_file=fn, loop=loop) as c: assert c.scheduler.port assert c.scheduler.port != 8786 From 27708755682b8510e19594f8b2058b6791228659 Mon Sep 17 00:00:00 2001 From: Benjamin Zaitlen Date: Fri, 3 Jun 2022 17:43:55 -0400 Subject: [PATCH 2/3] try much higher port --- distributed/cli/tests/test_dask_scheduler.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/distributed/cli/tests/test_dask_scheduler.py b/distributed/cli/tests/test_dask_scheduler.py index 658f01af820..9b9b724c7fa 100644 --- a/distributed/cli/tests/test_dask_scheduler.py +++ b/distributed/cli/tests/test_dask_scheduler.py @@ -99,23 +99,23 @@ def test_dashboard_non_standard_ports(loop): pytest.importorskip("bokeh") with popen( - ["dask-scheduler", "--port", "3448", "--dashboard-address", ":4832"] + ["dask-scheduler", "--port", "23448", "--dashboard-address", ":24832"] ) as proc: line = wait_for_log_line(b"dashboard at", proc.stdout) - with Client("127.0.0.1:3448", loop=loop) as c: + with Client("127.0.0.1:23448", loop=loop) as c: pass start = time() while True: try: - response = requests.get("http://localhost:4832/status/") + response = requests.get("http://localhost:24832/status/") assert response.ok break except Exception: sleep(0.1) assert time() < start + 20 with pytest.raises(Exception): - requests.get("http://localhost:4832/status/") + requests.get("http://localhost:24832/status/") @pytest.mark.skipif(not LINUX, reason="Need 127.0.0.2 to mean localhost") From 047447c7304ee546f30f2d691bb2cb3eb302ea7f Mon Sep 17 00:00:00 2001 From: Benjamin Zaitlen Date: Fri, 3 Jun 2022 18:19:08 -0400 Subject: [PATCH 3/3] forgot to flush output --- distributed/cli/tests/test_dask_scheduler.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/distributed/cli/tests/test_dask_scheduler.py b/distributed/cli/tests/test_dask_scheduler.py index 9b9b724c7fa..2e992a64143 100644 --- a/distributed/cli/tests/test_dask_scheduler.py +++ b/distributed/cli/tests/test_dask_scheduler.py @@ -99,7 +99,8 @@ def test_dashboard_non_standard_ports(loop): pytest.importorskip("bokeh") with popen( - ["dask-scheduler", "--port", "23448", "--dashboard-address", ":24832"] + ["dask-scheduler", "--port", "23448", "--dashboard-address", ":24832"], + flush_output=False, ) as proc: line = wait_for_log_line(b"dashboard at", proc.stdout) with Client("127.0.0.1:23448", loop=loop) as c: @@ -208,7 +209,8 @@ def check_pidfile(proc, pidfile): def test_scheduler_port_zero(loop): with tmpfile() as fn: with popen( - ["dask-scheduler", "--no-dashboard", "--scheduler-file", fn, "--port", "0"] + ["dask-scheduler", "--no-dashboard", "--scheduler-file", fn, "--port", "0"], + flush_output=False, ) as proc: line = wait_for_log_line(b"dashboard at", proc.stdout) with Client(scheduler_file=fn, loop=loop) as c: