Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: use ak.typetracer.touch_data #349

Merged
merged 2 commits into from
Sep 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading