Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion distributed/cli/tests/test_dask_scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -475,6 +475,11 @@ def test_version_option():
assert result.exit_code == 0


@pytest.mark.filterwarnings(
"ignore"
":The profiler was enabled in .* running the profiler in tests is not recommended"
":RuntimeWarning"
)
@pytest.mark.slow
def test_idle_timeout():
start = time()
Expand All @@ -483,8 +488,8 @@ def test_idle_timeout():
distributed.cli.dask_scheduler.main, ["--idle-timeout", "1s"]
)
stop = time()
assert 1 < stop - start < 10
assert result.exit_code == 0
assert 1 < stop - start < 10


@pytest.mark.slow
Expand Down
10 changes: 10 additions & 0 deletions distributed/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import asyncio
import inspect
import logging
import os
import sys
import threading
import traceback
Expand Down Expand Up @@ -356,6 +357,15 @@ def __init__(

if not hasattr(self.io_loop, "profile"):
if dask.config.get("distributed.worker.profile.enabled"):
current_test = os.environ.get("PYTEST_CURRENT_TEST")
if current_test:
warnings.warn(
f"The profiler was enabled in {current_test}."
" running the profiler in tests is not recommended.",
RuntimeWarning,
stacklevel=2,
)

ref = weakref.ref(self.io_loop)

def stop() -> bool:
Expand Down