Skip to content

Commit

Permalink
remove dask[distributed] deps
Browse files Browse the repository at this point in the history
  • Loading branch information
lorenzocerrone committed Oct 12, 2024
1 parent ed2af59 commit 2b4aea8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/ngio/core/image_like_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@
import numpy as np
import zarr
from dask.delayed import Delayed
from dask.distributed import Lock
from scipy.ndimage import zoom

from ngio._common_types import ArrayLike
from ngio.core.dimensions import Dimensions
from ngio.core.roi import WorldCooROI
from ngio.core.utils import Lock
from ngio.io import StoreOrGroup, open_group_wrapper
from ngio.ngff_meta import (
Dataset,
Expand Down Expand Up @@ -229,6 +229,10 @@ def on_disk_shape(self) -> tuple[int, ...]:
# Methods to get the image data in the canonical order
def init_lock(self, lock_id: str | None = None) -> None:
"""Set the lock for the Dask array."""
if Lock is None:
raise ImportError(
"Lock is not available. Please install dask[distributed]."
)
# Unique zarr array identifier
array_path = (
Path(self._group.store.path) / self._group.path / self._dataset.path
Expand Down
5 changes: 5 additions & 0 deletions src/ngio/core/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@
TimeUnits,
)

try:
from dask.distributed import Lock
except ImportError:
Lock = None


def _build_empty_pyramid(
group,
Expand Down

0 comments on commit 2b4aea8

Please sign in to comment.