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 calculation of MemoryShardsBuffer.bytes_read #8289

Merged
merged 1 commit into from
Oct 19, 2023
Merged
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
13 changes: 5 additions & 8 deletions distributed/shuffle/_memory.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,13 @@
raise RuntimeError("Tried to read from file before done.")

with self.time("read"):
shards = self._shards.pop(id) # Raises KeyError
self.bytes_read += sum(map(sizeof, shards))

Check warning on line 38 in distributed/shuffle/_memory.py

View check run for this annotation

Codecov / codecov/patch

distributed/shuffle/_memory.py#L37-L38

Added lines #L37 - L38 were not covered by tests
# Don't keep the serialized and the deserialized shards
# in memory at the same time
data = []
size = 0
shards = self._shards[id]
while shards:
shard = shards.pop()
data.append(self._deserialize(shard))
size += sizeof(shards)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should have been shard, not shards


if data:
self.bytes_read += size
return data
else:
raise KeyError(id)
return data

Check warning on line 46 in distributed/shuffle/_memory.py

View check run for this annotation

Codecov / codecov/patch

distributed/shuffle/_memory.py#L46

Added line #L46 was not covered by tests
Loading