Skip to content

Migrate dependencies dependents sets from TaskState to Key #9042

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

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from
Draft
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
6 changes: 2 additions & 4 deletions distributed/diagnostics/graph_layout.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,17 +46,15 @@ def __init__(self, scheduler):
priority=priority,
)

def update_graph(
self, scheduler, *, dependencies=None, priority=None, tasks=None, **kwargs
):
def update_graph(self, scheduler, *, priority=None, tasks=None, **kwargs):
stack = sorted(
tasks, key=lambda k: TupleComparable(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.get(key, ())
deps = [ts.key for ts in scheduler.tasks[key].dependencies]
if deps:
if not all(dep in self.y for dep in deps):
stack.append(key)
Expand Down
3 changes: 0 additions & 3 deletions distributed/diagnostics/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@ def update_graph(
tasks: list[Key],
annotations: dict[str, dict[Key, Any]],
priority: dict[Key, tuple[int | float, ...]],
dependencies: dict[Key, set[Key]],
stimulus_id: str,
**kwargs: Any,
) -> None:
Expand Down Expand Up @@ -128,8 +127,6 @@ def update_graph(
}
priority:
Task calculated priorities as assigned to the tasks.
dependencies:
A mapping that maps a key to its dependencies.
stimulus_id:
ID of the stimulus causing the graph update
**kwargs:
Expand Down
7 changes: 0 additions & 7 deletions distributed/diagnostics/tests/test_scheduler_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -492,7 +492,6 @@ def update_graph( # type: ignore
tasks,
annotations,
priority,
dependencies,
stimulus_id,
**kwargs,
) -> None:
Expand All @@ -505,7 +504,6 @@ def update_graph( # type: ignore
assert annotations == {}
assert len(priority) == 1
assert isinstance(priority["foo"], tuple)
assert dependencies == {"foo": set()}
assert stimulus_id is not None
self.success = True

Expand Down Expand Up @@ -534,7 +532,6 @@ def update_graph( # type: ignore
tasks,
annotations,
priority,
dependencies,
stimulus_id,
**kwargs,
) -> None:
Expand All @@ -552,10 +549,6 @@ def update_graph( # type: ignore
}
assert len(priority) == len(tasks), priority
assert priority["f2"][0] == -13
for k in keys:
assert k in dependencies
assert dependencies["f1"] == set()
assert dependencies["sum"] == {"f1", "f3"}
assert stimulus_id is not None

self.success = True
Expand Down
Loading
Loading