Skip to content

Commit

Permalink
fix: projected AwkwardInputLayers have __dask_tokenize__
Browse files Browse the repository at this point in the history
  • Loading branch information
lgray committed Feb 12, 2024
1 parent 63c003f commit 24a9d11
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/dask_awkward/layers/layers.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,19 @@ def io_func_implements_report(func: ImplementsIOFunction) -> bool:
return hasattr(func, "return_report")


class AwkwardTokenizable:

def __init__(self, ret_func, parent_name):
self.parent_name = parent_name
self.ret_func = ret_func

def __dask_tokenize__(self):
return (AwkwardTokenizable, self.parent_name)

def __call__(self, *_, **__):
return self.ret_func


class AwkwardInputLayer(AwkwardBlockwiseLayer):
"""A layer known to perform IO and produce Awkward arrays
Expand Down Expand Up @@ -230,7 +243,7 @@ def prepare_for_projection(self) -> tuple[AwkwardInputLayer, TypeTracerReport, T
new_input_layer = AwkwardInputLayer(
name=self.name,
inputs=[None][: int(list(self.numblocks.values())[0][0])],
io_func=lambda *_, **__: new_return,
io_func=AwkwardTokenizable(new_return, self.name),
label=self.label,
produces_tasks=self.produces_tasks,
creation_info=self.creation_info,
Expand Down

0 comments on commit 24a9d11

Please sign in to comment.