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

Make rootish heuristic sensitive to size of task group #8005

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
2 changes: 1 addition & 1 deletion distributed/scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -2899,7 +2899,7 @@ def is_rootish(self, ts: TaskState) -> bool:
return (
len(tg) > self.total_nthreads * 2
and len(tg.dependencies) < 5
and sum(map(len, tg.dependencies)) < 5
and sum(map(len, tg.dependencies)) < max(5, len(tg) * 0.01)
)

def check_idle_saturated(self, ws: WorkerState, occ: float = -1.0) -> None:
Expand Down
15 changes: 15 additions & 0 deletions distributed/tests/test_scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -4477,3 +4477,18 @@ async def test_scatter_creates_ts(c, s, a, b):
await a.close()
assert await x2 == 2
assert s.tasks["x"].run_spec is not None


@gen_cluster(client=True)
async def test_rootish_for_many_tasks(c, s, a, b):
def f(x, y=None):
pass

base = c.map(inc, range(10))
derived = c.map(f, range(2000), y=base)

while derived[0].key not in s.tasks:
await asyncio.sleep(0.01)

ts = s.tasks[derived[0].key]
assert s.is_rootish(s.tasks[derived[0].key])