Skip to content

Commit 9da5824

Browse files
authored
Disable profiler on python 3.11 (#8916)
1 parent 2953090 commit 9da5824

File tree

8 files changed

+31
-1
lines changed

8 files changed

+31
-1
lines changed

distributed/core.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,10 @@ def __init__(
312312
self.io_loop = self.loop = IOLoop.current()
313313

314314
if not hasattr(self.io_loop, "profile"):
315-
if dask.config.get("distributed.worker.profile.enabled"):
315+
if (
316+
dask.config.get("distributed.worker.profile.enabled")
317+
and sys.version_info.minor != 11
318+
):
316319
ref = weakref.ref(self.io_loop)
317320

318321
def stop() -> bool:

distributed/dashboard/components/shared.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
from __future__ import annotations
22

33
import asyncio
4+
import sys
45
import weakref
56

67
import tlz as toolz
@@ -275,6 +276,12 @@ def select_cb(attr, old, new):
275276
self.profile_plot.add_layout(self.subtitle, "above")
276277
if not dask.config.get("distributed.worker.profile.enabled"):
277278
self.subtitle.text = "Profiling is disabled."
279+
280+
self.select.disabled = True
281+
self.reset_button.disabled = True
282+
self.update_button.disabled = True
283+
elif sys.version_info.minor == 11:
284+
self.subtitle.text = "Profiling is disabled due to a known deadlock in CPython 3.11 that can be triggered by the profiler. See https://github.com/dask/distributed/issues/8616 for more information."
278285
self.select.disabled = True
279286
self.reset_button.disabled = True
280287
self.update_button.disabled = True
@@ -403,6 +410,10 @@ def ts_change(attr, old, new):
403410
self.subtitle.text = "Profiling is disabled."
404411
self.reset_button.disabled = True
405412
self.update_button.disabled = True
413+
elif sys.version_info.minor == 11:
414+
self.subtitle.text = "Profiling is disabled due to a known deadlock in CPython 3.11 that can be triggered by the profiler. See https://github.com/dask/distributed/issues/8616 for more information."
415+
self.reset_button.disabled = True
416+
self.update_button.disabled = True
406417

407418
@without_property_validation
408419
@log_errors

distributed/dashboard/tests/test_components.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
pytest.importorskip("bokeh")
66

7+
import sys
8+
79
from bokeh.models import ColumnDataSource, Model
810

911
from distributed.dashboard.components.shared import (
@@ -21,6 +23,7 @@ def test_basic(Component):
2123
assert isinstance(c.root, Model)
2224

2325

26+
@pytest.mark.skipif(sys.version_info.minor == 11, reason="Profiler disabled")
2427
@gen_cluster(
2528
client=True,
2629
clean_kwargs={"threads": False},
@@ -34,6 +37,7 @@ async def test_profile_plot(c, s, a, b):
3437
p.update(a.profile_recent)
3538

3639

40+
@pytest.mark.skipif(sys.version_info.minor == 11, reason="Profiler disabled")
3741
@gen_cluster(
3842
client=True,
3943
clean_kwargs={"threads": False},

distributed/dashboard/tests/test_scheduler_bokeh.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1010,6 +1010,7 @@ async def test_TaskGroupGraph_arrows(c, s, a, b):
10101010
assert not any(tgg.arrows_source.data.values())
10111011

10121012

1013+
@pytest.mark.skipif(sys.version_info.minor == 11, reason="Profiler disabled")
10131014
@gen_cluster(
10141015
client=True,
10151016
config={

distributed/tests/test_actor.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import asyncio
44
import operator
5+
import sys
56
from time import sleep
67

78
import pytest
@@ -526,6 +527,7 @@ def check(dask_worker):
526527
assert time() < start + 30
527528

528529

530+
@pytest.mark.skipif(sys.version_info.minor == 11, reason="Profiler disabled")
529531
@gen_cluster(
530532
client=True,
531533
nthreads=[("127.0.0.1", 1)],

distributed/tests/test_client.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5521,6 +5521,7 @@ async def test_call_stack_collections_all(c, s, a, b):
55215521
assert result
55225522

55235523

5524+
@pytest.mark.skipif(sys.version_info.minor == 11, reason="Profiler disabled")
55245525
@pytest.mark.flaky(condition=WINDOWS, reruns=10, reruns_delay=5)
55255526
@gen_cluster(
55265527
client=True,
@@ -6374,6 +6375,7 @@ async def test_futures_of_sorted(c, s, a, b):
63746375
assert [fut.key for fut in futures] == [k for k in b.__dask_keys__()]
63756376

63766377

6378+
@pytest.mark.skipif(sys.version_info.minor == 11, reason="Profiler disabled")
63776379
@gen_cluster(
63786380
client=True,
63796381
config={

distributed/tests/test_scheduler.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1973,6 +1973,7 @@ async def test_profile_metadata(c, s, a, b):
19731973
assert not meta["counts"][-1][1]
19741974

19751975

1976+
@pytest.mark.skipif(sys.version_info.minor == 11, reason="Profiler disabled")
19761977
@gen_cluster(
19771978
client=True,
19781979
config={
@@ -2000,6 +2001,7 @@ def raise_timeout(*args, **kwargs):
20002001
assert not meta["counts"][-1][1]
20012002

20022003

2004+
@pytest.mark.skipif(sys.version_info.minor == 11, reason="Profiler disabled")
20032005
@gen_cluster(
20042006
client=True,
20052007
config={
@@ -2019,6 +2021,7 @@ async def test_profile_metadata_keys(c, s, a, b):
20192021
)
20202022

20212023

2024+
@pytest.mark.skipif(sys.version_info.minor == 11, reason="Profiler disabled")
20222025
@gen_cluster(
20232026
client=True,
20242027
config={
@@ -2036,6 +2039,7 @@ async def test_statistical_profiling(c, s, a, b):
20362039
assert profile["count"]
20372040

20382041

2042+
@pytest.mark.skipif(sys.version_info.minor == 11, reason="Profiler disabled")
20392043
@gen_cluster(
20402044
client=True,
20412045
config={

distributed/tests/test_worker.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1161,6 +1161,7 @@ async def test_scheduler_delay(c, s, a, b):
11611161
assert a.scheduler_delay != old
11621162

11631163

1164+
@pytest.mark.skipif(sys.version_info.minor == 11, reason="Profiler disabled")
11641165
@pytest.mark.flaky(reruns=10, reruns_delay=5)
11651166
@gen_cluster(
11661167
client=True,
@@ -1176,6 +1177,7 @@ async def test_statistical_profiling(c, s, a, b):
11761177
assert profile["count"]
11771178

11781179

1180+
@pytest.mark.skipif(sys.version_info.minor == 11, reason="Profiler disabled")
11791181
@pytest.mark.slow
11801182
@nodebug
11811183
@gen_cluster(
@@ -1202,6 +1204,7 @@ async def test_statistical_profiling_2(c, s, a, b):
12021204
break
12031205

12041206

1207+
@pytest.mark.skipif(sys.version_info.minor == 11, reason="Profiler disabled")
12051208
@gen_cluster(
12061209
client=True,
12071210
config={

0 commit comments

Comments
 (0)