Skip to content

Commit

Permalink
better check for dask._task_spec
Browse files Browse the repository at this point in the history
  • Loading branch information
lgray authored Dec 7, 2024
1 parent 57a2472 commit 6a19642
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/dask_awkward/layers/layers.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

import dask

_dask_uses_tasks = dask.__version__ >= "2024.12.0"
_dask_uses_tasks = hasattr(dask, "_task_spec")

from dask.blockwise import Blockwise, BlockwiseDepDict, blockwise_token
from dask.highlevelgraph import MaterializedLayer
Expand All @@ -15,6 +15,9 @@

from dask_awkward.utils import LazyInputsDict

if _dask_uses_tasks:
from dask._task_spec import Task, TaskRef

if TYPE_CHECKING:
from awkward import Array as AwkwardArray
from awkward._nplikes.typetracer import TypeTracerReport
Expand Down Expand Up @@ -173,8 +176,6 @@ def __init__(
}

if _dask_uses_tasks:
from dask._task_spec import Task, TaskRef

super_kwargs["task"] = Task(name, self.io_func, TaskRef(blockwise_token(0)))
else:
super_kwargs["dsk"] = {name: (self.io_func, blockwise_token(0))}
Expand Down

0 comments on commit 6a19642

Please sign in to comment.