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

Fix un-merged frames #4666

Merged
merged 3 commits into from
Apr 2, 2021
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
11 changes: 7 additions & 4 deletions distributed/protocol/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,14 @@ def _encode_default(obj):
if typ is Serialize:
obj = obj.data
offset = len(frames)
sub_header, sub_frames = serialize_and_split(
obj, serializers=serializers, on_error=on_error, context=context
)
if typ is Serialized:
sub_header, sub_frames = obj.header, obj.frames
else:
sub_header, sub_frames = serialize_and_split(
obj, serializers=serializers, on_error=on_error, context=context
)
_inplace_compress_frames(sub_header, sub_frames)
sub_header["num-sub-frames"] = len(sub_frames)
_inplace_compress_frames(sub_header, sub_frames)
frames.append(
msgpack.dumps(
sub_header, default=msgpack_encode_default, use_bin_type=True
Expand Down
16 changes: 15 additions & 1 deletion distributed/protocol/tests/test_serialize.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

from dask.utils_test import inc

from distributed import wait
from distributed import Nanny, wait
from distributed.comm.utils import from_frames, to_frames
from distributed.protocol import (
Serialize,
Expand Down Expand Up @@ -499,3 +499,17 @@ def test_ser_memoryview_object():
data_in = memoryview(np.array(["hello"], dtype=object))
with pytest.raises(TypeError):
serialize(data_in, on_error="raise")


@gen_cluster(client=True, Worker=Nanny)
async def test_large_pickled_object(c, s, a, b):
np = pytest.importorskip("numpy")

class Data:
def __init__(self, n):
self.data = np.empty(n, dtype="u1")

x = Data(100_000_000)
y = await c.scatter(x, workers=[a.worker_address])
z = c.submit(lambda x: x, y, workers=[b.worker_address])
await z