Skip to content

Commit

Permalink
Merge pull request #349 from dask-contrib/agoose77/refactor-use-ak-to…
Browse files Browse the repository at this point in the history
…uch-data

refactor: use `ak.typetracer.touch_data`
  • Loading branch information
agoose77 authored Sep 5, 2023
2 parents 21fc848 + b0db78b commit e9125b4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
5 changes: 2 additions & 3 deletions src/dask_awkward/lib/optimize.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,8 +192,7 @@ def _touch_all_data(*args, **kwargs):
import awkward as ak

for arg in args + tuple(kwargs.values()):
if isinstance(arg, ak.Array):
arg.layout._touch_data(recursive=True)
ak.typetracer.touch_data(arg)


def _mock_output(layer):
Expand Down Expand Up @@ -393,7 +392,7 @@ def _get_column_reports(dsk: HighLevelGraph) -> dict[str, Any]:
results = get_sync(hlg, leaf_layers_keys)
for out in results:
if isinstance(out, (ak.Array, ak.Record)):
out.layout._touch_data(recursive=True)
ak.typetracer.touch_data(out)
except Exception as err:
on_fail = dask.config.get("awkward.optimization.on-fail")
# this is the default, throw a warning but skip the optimization.
Expand Down
7 changes: 2 additions & 5 deletions src/dask_awkward/lib/structure.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,8 @@ def __call__(self, *arrays):
# FIXME: with proper typetracer/form rehydration support we
# should not need to manually touch this when it's a
# typetracer
for a in arrays:
if ak.backend(a) == "typetracer":
a.layout._touch_data(recursive=True)

return ak.argcartesian(list(arrays), **self.kwargs)
arrays = [ak.typetracer.touch_data(a) for a in arrays]
return ak.argcartesian(arrays, **self.kwargs)


@borrow_docstring(ak.argcartesian)
Expand Down

0 comments on commit e9125b4

Please sign in to comment.