Skip to content

Commit d0f0955

Browse files
committed
WIP slightly different metric
Here we're assuming that all tasks in the group have a similar number of dependents / degree of fan-out. Then if this dependency is widely used enough to fill the cluster, and there are not nearly enough like it to fill the cluster, then we should be okay with copying it around to enable parallelism (ignoring it, since other dependencies of the task are likely more important).
1 parent e5175ce commit d0f0955

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

distributed/scheduler.py

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7979,6 +7979,9 @@ def decide_worker(
79797979
dts: TaskState
79807980
deps: set = ts._dependencies
79817981
candidates: set
7982+
n_workers: Py_ssize_t = len(
7983+
valid_workers if valid_workers is not None else all_workers
7984+
)
79827985
assert all([dts._who_has for dts in deps])
79837986
if ts._actor:
79847987
candidates = set(all_workers)
@@ -7987,8 +7990,18 @@ def decide_worker(
79877990
wws
79887991
for dts in deps
79897992
# Ignore dependencies that will need to be, or already are, copied to all workers
7990-
if max(len(dts._dependents) / len(dts._group), len(dts._who_has))
7991-
< len(valid_workers if valid_workers is not None else all_workers)
7993+
if len(dts._who_has) < n_workers
7994+
and not (
7995+
len(dts._dependents) >= n_workers
7996+
and len(dts._group) < n_workers // 2
7997+
# Really want something like:
7998+
# map(len, dts._group._dependents) >= nthreads and len(dts._group) < n_workers // 2
7999+
# Or at least
8000+
# len(dts._dependents) * len(dts._group) >= nthreads and len(dts._group) < n_workers // 2
8001+
# But `nthreads` is O(k) to calcualte if given `valid_workers`.
8002+
# and the `map(len, dts._group._dependents)` could be extremely expensive since we can't put
8003+
# much of an upper bound on it.
8004+
)
79928005
for wws in dts._who_has
79938006
}
79948007
if valid_workers is None:

0 commit comments

Comments
 (0)