Skip to content

Commit

Permalink
Store occupancy in transition_waiting_processing (#4330)
Browse files Browse the repository at this point in the history
Instead of computing the sum of the task duration and communication cost
repeatedly, simply compute it once and assign it to a variable. Then
reuse it in later steps.
  • Loading branch information
jakirkham authored Dec 8, 2020
1 parent 9f5426e commit 47876b6
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions distributed/scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -4712,11 +4712,12 @@ def transition_waiting_processing(self, key):

duration = self.get_task_duration(ts)
comm = self.get_comm_cost(ts, ws)
occupancy = duration + comm

ws._processing[ts] = duration + comm
ws._processing[ts] = occupancy
ts._processing_on = ws
ws._occupancy += duration + comm
self.total_occupancy += duration + comm
ws._occupancy += occupancy
self.total_occupancy += occupancy
ts.state = "processing"
self.consume_resources(ts, ws)
self.check_idle_saturated(ws)
Expand Down

0 comments on commit 47876b6

Please sign in to comment.