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

No longer double count transfer cost in stealing #7036

Merged
merged 10 commits into from
Sep 16, 2022
9 changes: 8 additions & 1 deletion distributed/scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -2892,7 +2892,7 @@ def check_idle_saturated(self, ws: WorkerState, occ: float = -1.0):
idle = self.idle
saturated = self.saturated
if (
(p < nc or occ < nc * avg / 2)
self.is_unoccupied(ws, occ, p)
if math.isinf(self.WORKER_SATURATION)
else not _worker_full(ws, self.WORKER_SATURATION)
):
Expand All @@ -2910,6 +2910,13 @@ def check_idle_saturated(self, ws: WorkerState, occ: float = -1.0):

saturated.discard(ws)

def is_unoccupied(
self, ws: WorkerState, occupancy: float, nprocessing: int
) -> bool:
nthreads = ws.nthreads
avg_occ_per_thread = self.total_occupancy / self.total_nthreads
return nprocessing < nthreads or occupancy < nthreads * avg_occ_per_thread / 2

def get_comm_cost(self, ts: TaskState, ws: WorkerState) -> float:
"""
Get the estimated communication cost (in s.) to compute the task
Expand Down
Loading