Skip to content

Commit

Permalink
Don't send empty dependencies (#3423)
Browse files Browse the repository at this point in the history
  • Loading branch information
Kobzol authored May 23, 2020
1 parent b9e4953 commit 3c7b5b1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
1 change: 1 addition & 0 deletions distributed/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -2574,6 +2574,7 @@ def _graph_to_futures(
dependencies = {
tokey(k): [tokey(dep) for dep in deps]
for k, deps in dependencies.items()
if deps
}
for k, deps in future_dependencies.items():
if deps:
Expand Down
13 changes: 9 additions & 4 deletions distributed/diagnostics/graph_layout.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,21 @@ def __init__(self, scheduler):
}
priority = {k: ts.priority for k, ts in scheduler.tasks.items()}
self.update_graph(
self.scheduler, dependencies=dependencies, priority=priority
self.scheduler,
tasks=self.scheduler.tasks,
dependencies=dependencies,
priority=priority,
)

def update_graph(self, scheduler, dependencies=None, priority=None, **kwargs):
stack = sorted(dependencies, key=lambda k: priority.get(k, 0), reverse=True)
def update_graph(
self, scheduler, dependencies=None, priority=None, tasks=None, **kwargs
):
stack = sorted(tasks, key=lambda k: priority.get(k, 0), reverse=True)
while stack:
key = stack.pop()
if key in self.x or key not in scheduler.tasks:
continue
deps = dependencies[key]
deps = dependencies.get(key, ())
if deps:
if not all(dep in self.y for dep in deps):
stack.append(key)
Expand Down

0 comments on commit 3c7b5b1

Please sign in to comment.