Skip to content

Commit

Permalink
Cosmetic tweak to adaptive_target (#8052)
Browse files Browse the repository at this point in the history
  • Loading branch information
crusaderky committed Jul 31, 2023
1 parent a7f7764 commit 9a9d2c3
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions distributed/scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -8071,18 +8071,17 @@ def adaptive_target(self, target_duration=None):
else:
queued_occupancy += ts.prefix.duration_average

if len(self.queued) + len(self.unrunnable) > 100:
queued_occupancy *= (len(self.queued) + len(self.unrunnable)) / 100
tasks_ready = len(self.queued) + len(self.unrunnable)
if tasks_ready > 100:
queued_occupancy *= tasks_ready / 100

cpu = math.ceil((self.total_occupancy + queued_occupancy) / target_duration)

# Avoid a few long tasks from asking for many cores
tasks_ready = len(self.queued) + len(self.unrunnable)
for ws in self.workers.values():
tasks_ready += len(ws.processing)

if tasks_ready > cpu:
break
tasks_ready += len(ws.processing)
else:
cpu = min(tasks_ready, cpu)

Expand Down

0 comments on commit 9a9d2c3

Please sign in to comment.