Skip to content

Commit 72f297a

Browse files
authored
Allow large graph warning threshold to be configured (#8508)
1 parent bbe578f commit 72f297a

File tree

4 files changed

+13
-1
lines changed

4 files changed

+13
-1
lines changed

distributed/client.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
ensure_dict,
4242
format_bytes,
4343
funcname,
44+
parse_bytes,
4445
parse_timedelta,
4546
shorten_traceback,
4647
typename,
@@ -3162,7 +3163,9 @@ def _graph_to_futures(
31623163
header, frames = serialize(ToPickle(dsk), on_error="raise")
31633164

31643165
pickled_size = sum(map(nbytes, [header] + frames))
3165-
if pickled_size > 10_000_000:
3166+
if pickled_size > parse_bytes(
3167+
dask.config.get("distributed.admin.large-graph-warning-threshold")
3168+
):
31663169
warnings.warn(
31673170
f"Sending large graph of size {format_bytes(pickled_size)}.\n"
31683171
"This may cause some slowdown.\n"

distributed/distributed-schema.yaml

+6
Original file line numberDiff line numberDiff line change
@@ -1103,6 +1103,12 @@ properties:
11031103
description: |
11041104
Options for logs, event loops, and so on
11051105
properties:
1106+
large-graph-warning-threshold:
1107+
type: string
1108+
description: |
1109+
Threshold in bytes for when a warning is raised about a large
1110+
submitted task graph.
1111+
Default is 10MB.
11061112
tick:
11071113
type: object
11081114
description: |

distributed/distributed.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,7 @@ distributed:
323323
##################
324324

325325
admin:
326+
large-graph-warning-threshold: 10MB # Threshold for warning on large graph
326327
tick:
327328
interval: 20ms # time between event loop health checks
328329
limit: 3s # time allowed before triggering a warning

distributed/tests/test_client.py

+2
Original file line numberDiff line numberDiff line change
@@ -5975,6 +5975,8 @@ async def test_config_scheduler_address(s, a, b):
59755975
async def test_warn_when_submitting_large_values(c, s):
59765976
with pytest.warns(UserWarning, match="Sending large graph of size"):
59775977
future = c.submit(lambda x: x + 1, b"0" * 10_000_000)
5978+
with dask.config.set({"distributed.admin.large-graph-warning-threshold": "1GB"}):
5979+
future = c.submit(lambda x: x + 1, b"0" * 10_000_000)
59785980

59795981

59805982
@gen_cluster(client=True, nthreads=[])

0 commit comments

Comments
 (0)