Skip to content

[WIP] Optionally use mmaping of files with spilling #6516

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

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
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
14 changes: 12 additions & 2 deletions distributed/spill.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,16 +228,26 @@ class Slow(zict.Func):
max_weight: int | Literal[False]
weight_by_key: dict[str, SpilledSize]
total_weight: SpilledSize
memmap: bool

def __init__(self, spill_directory: str, max_weight: int | Literal[False] = False):
def __init__(
self,
spill_directory: str,
max_weight: int | Literal[False] = False,
memmap: bool = False,
):
file_kwargs = {}
if memmap:
file_kwargs["memmap"] = memmap
super().__init__(
partial(serialize_bytelist, on_error="raise"),
deserialize_bytes,
zict.File(spill_directory),
zict.File(spill_directory, **file_kwargs), # type: ignore
Copy link
Collaborator

Choose a reason for hiding this comment

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

Style nitpick: please check for has_zict_210 instead like it already happens above

Copy link
Collaborator

Choose a reason for hiding this comment

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

(also, your branch from main is several months old)

)
self.max_weight = max_weight
self.weight_by_key = {}
self.total_weight = SpilledSize(0, 0)
self.memmap = memmap

def __setitem__(self, key: str, value: Any) -> None:
try:
Expand Down