Skip to content

Commit

Permalink
Remove code for Distributed<2023.5.1 compatibility (#1191)
Browse files Browse the repository at this point in the history
Closes #1174

Authors:
  - Peter Andreas Entschev (https://github.com/pentschev)

Approvers:
  - Mads R. B. Kristensen (https://github.com/madsbk)
  - GALI PREM SAGAR (https://github.com/galipremsagar)

URL: #1191
  • Loading branch information
pentschev authored Jun 7, 2023
1 parent ebc56ba commit be80134
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 19 deletions.
10 changes: 3 additions & 7 deletions dask_cuda/device_host_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
serialize_bytelist,
)
from distributed.sizeof import safe_sizeof
from distributed.utils import has_arg, nbytes
from distributed.utils import nbytes

from .is_device_object import is_device_object
from .is_spillable_object import is_spillable_object
Expand All @@ -27,12 +27,8 @@
def _serialize_bytelist(x, **kwargs):
kwargs["on_error"] = "raise"

if has_arg(serialize_bytelist, "compression"):
compression = dask.config.get("distributed.worker.memory.spill-compression")
return serialize_bytelist(x, compression=compression, **kwargs)
else:
# For Distributed < 2023.5.0 compatibility
return serialize_bytelist(x, **kwargs)
compression = dask.config.get("distributed.worker.memory.spill-compression")
return serialize_bytelist(x, compression=compression, **kwargs)


class LoggedBuffer(Buffer):
Expand Down
13 changes: 1 addition & 12 deletions dask_cuda/tests/test_device_host_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,8 @@

import numpy as np
import pytest
from packaging import version

import dask.array
import distributed
from distributed.protocol import (
deserialize,
deserialize_bytes,
Expand Down Expand Up @@ -53,16 +51,7 @@ def test_device_host_file_short(
random.shuffle(full)

for k, v in full:
try:
dhf[k] = v
except TypeError as e:
# TODO: Remove when pinning to distributed>=2023.5.1 .
# See https://github.com/rapidsai/dask-cuda/issues/1174 and
# https://github.com/dask/distributed/pull/7836 .
if version.parse(distributed.__version__) <= version.parse("2023.5.0"):
dhf[k] = v
else:
raise e
dhf[k] = v

random.shuffle(full)

Expand Down

0 comments on commit be80134

Please sign in to comment.