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

Use Taskspec fuse implementation #1162

Merged
merged 4 commits into from
Nov 13, 2024
Merged
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
19 changes: 2 additions & 17 deletions dask_expr/_expr.py
Original file line number Diff line number Diff line change
Expand Up @@ -3766,31 +3766,16 @@ def _broadcast_dep(self, dep: Expr):

def _task(self, name: Key, index: int) -> Task:
internal_tasks = []
seen_keys = set()
external_deps = set()
for _expr in self.exprs:
if self._broadcast_dep(_expr):
subname = (_expr._name, 0)
else:
subname = (_expr._name, index)
t = _expr._task(subname, subname[1])

assert t.key == subname
internal_tasks.append(t)
seen_keys.add(subname)
external_deps.update(t.dependencies)
external_deps -= seen_keys
dependencies = {dep: TaskRef(dep) for dep in external_deps}
t = Task(
name,
Fused._execute_internal_graph,
# Wrap the actual subgraph as a data node such that the tasks are
# not erroneously parsed. The external task would otherwise carry
# the internal keys as dependencies which is not satisfiable
DataNode(None, internal_tasks),
dependencies,
(self.exprs[0]._name, index),
)
return t
return Task.fuse(*internal_tasks, key=name)

@staticmethod
def _execute_internal_graph(internal_tasks, dependencies, outkey):
Expand Down
Loading