Skip to content

Commit

Permalink
Backport from dask#5904
Browse files Browse the repository at this point in the history
  • Loading branch information
crusaderky committed Mar 14, 2022
1 parent 2fffe74 commit 60ad756
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 12 deletions.
4 changes: 2 additions & 2 deletions distributed/spill.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
from distributed.sizeof import safe_sizeof

logger = logging.getLogger(__name__)
has_zict_210 = parse_version(zict.__version__) > parse_version("2.0.0")
has_zict_210 = parse_version(zict.__version__) >= parse_version("2.1.0")


class SpilledSize(NamedTuple):
Expand Down Expand Up @@ -63,7 +63,7 @@ def __init__(
):

if max_spill is not False and not has_zict_210:
raise ValueError("zict > 2.0.0 required to set max_weight")
raise ValueError("zict >= 2.1.0 required to set max-spill")

super().__init__(
fast={},
Expand Down
16 changes: 6 additions & 10 deletions distributed/tests/test_spill.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,18 @@

import pytest

zict = pytest.importorskip("zict")
from packaging.version import parse as parse_version

from dask.sizeof import sizeof

from distributed.compatibility import WINDOWS
from distributed.protocol import serialize_bytelist
from distributed.spill import SpillBuffer
from distributed.spill import SpillBuffer, has_zict_210
from distributed.utils_test import captured_logger

requires_zict_210 = pytest.mark.skipif(
not has_zict_210,
reason="requires zict version >= 2.1.0",
)


def psize(*objs) -> tuple[int, int]:
return (
Expand Down Expand Up @@ -105,12 +107,6 @@ def test_spillbuffer(tmpdir):
assert buf.slow.total_weight == psize(d, e)


requires_zict_210 = pytest.mark.skipif(
parse_version(zict.__version__) <= parse_version("2.0.0"),
reason="requires zict version > 2.0.0",
)


@requires_zict_210
def test_spillbuffer_maxlim(tmpdir):
buf = SpillBuffer(str(tmpdir), target=200, max_spill=600, min_log_interval=0)
Expand Down

0 comments on commit 60ad756

Please sign in to comment.