Skip to content

Commit

Permalink
No longer double count transfer cost in stealing (dask#7036)
Browse files Browse the repository at this point in the history
Co-authored-by: fjetter <fjetter@users.noreply.github.com>
  • Loading branch information
2 people authored and gjoseph92 committed Oct 31, 2022
1 parent dc8d8a7 commit 07f8265
Show file tree
Hide file tree
Showing 6 changed files with 251 additions and 220 deletions.
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

0 comments on commit 07f8265

Please sign in to comment.