Skip to content

Commit

Permalink
raise error when AMM is enabled and broadcast=True is used in scatter
Browse files Browse the repository at this point in the history
  • Loading branch information
rjzamora committed Jul 23, 2024
1 parent 7013e2e commit 88c8565
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
11 changes: 11 additions & 0 deletions distributed/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -2779,6 +2779,17 @@ def scatter(
"Consider using a normal for loop and Client.submit"
)

if broadcast and dask.config.get(
"distributed.scheduler.active-memory-manager.start"
):
raise RuntimeError(
"Scattering data with broadcast=True is incompatible "
"with the Active Memory Manager’s ReduceReplicas "
"policy. Please disable the AMM plugin by setting "
"the following config to False: "
"'distributed.scheduler.active-memory-manager.start'"
)

try:
local_worker = get_worker()
except ValueError:
Expand Down
6 changes: 6 additions & 0 deletions distributed/tests/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -2353,6 +2353,12 @@ async def test__broadcast(c, s, a, b):
assert a.data == b.data == {x.key: 1, y.key: 2}


@gen_cluster(client=True)
async def test__broadcast_raises(c, s, a, b):
with pytest.raises(RuntimeError):
await c.scatter([1, 2], broadcast=True)


@gen_cluster(client=True, nthreads=[("127.0.0.1", 1)] * 4, config=NO_AMM)
async def test__broadcast_integer(c, s, *workers):
x, y = await c.scatter([1, 2], broadcast=2)
Expand Down

0 comments on commit 88c8565

Please sign in to comment.