Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow large graph warning threshold to be configured #8508

Merged
merged 2 commits into from
Feb 15, 2024
Merged
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
5 changes: 4 additions & 1 deletion distributed/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
ensure_dict,
format_bytes,
funcname,
parse_bytes,
parse_timedelta,
shorten_traceback,
typename,
Expand Down Expand Up @@ -3162,7 +3163,9 @@
header, frames = serialize(ToPickle(dsk), on_error="raise")

pickled_size = sum(map(nbytes, [header] + frames))
if pickled_size > 10_000_000:
if pickled_size > parse_bytes(

Check warning on line 3166 in distributed/client.py

View check run for this annotation

Codecov / codecov/patch

distributed/client.py#L3166

Added line #L3166 was not covered by tests
dask.config.get("distributed.admin.large-graph-warning-threshold")
):
warnings.warn(
f"Sending large graph of size {format_bytes(pickled_size)}.\n"
"This may cause some slowdown.\n"
Expand Down
6 changes: 6 additions & 0 deletions distributed/distributed-schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1103,6 +1103,12 @@ properties:
description: |
Options for logs, event loops, and so on
properties:
large-graph-warning-threshold:
type: string
description: |
Threshold in bytes for when a warning is raised about a large
submitted task graph.
Default is 10MB.
tick:
type: object
description: |
Expand Down
1 change: 1 addition & 0 deletions distributed/distributed.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,7 @@ distributed:
##################

admin:
large-graph-warning-threshold: 10MB # Threshold for warning on large graph
tick:
interval: 20ms # time between event loop health checks
limit: 3s # time allowed before triggering a warning
Expand Down
2 changes: 2 additions & 0 deletions distributed/tests/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -5975,6 +5975,8 @@ async def test_config_scheduler_address(s, a, b):
async def test_warn_when_submitting_large_values(c, s):
with pytest.warns(UserWarning, match="Sending large graph of size"):
future = c.submit(lambda x: x + 1, b"0" * 10_000_000)
with dask.config.set({"distributed.admin.large-graph-warning-threshold": "1GB"}):
future = c.submit(lambda x: x + 1, b"0" * 10_000_000)


@gen_cluster(client=True, nthreads=[])
Expand Down
Loading