Skip to content

Commit

Permalink
rename fully_idle -> is_idle
Browse files Browse the repository at this point in the history
  • Loading branch information
crusaderky committed May 22, 2023
1 parent 6251ded commit 0cf5145
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions distributed/scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -1518,7 +1518,8 @@ class SchedulerState:
running: set[WorkerState]
#: Workers that are currently in running state and not fully utilized
#: Definition based on occupancy
#: (actually a SortedDict, but the sortedcontainers package isn't annotated)
#: (actually a SortedDict, but the sortedcontainers package isn't annotated).
#: Not to be confused with :meth:`is_idle`.
idle: dict[str, WorkerState]
#: Similar to `idle`
#: Definition based on assigned tasks
Expand Down Expand Up @@ -1776,11 +1777,13 @@ def _clear_task_state(self) -> None:
collection.clear() # type: ignore

@property
def fully_idle(self) -> bool:
def is_idle(self) -> bool:
"""Return True iff there are no tasks that haven't finished computing.
Unlike testing `self.total_occupancy`, this property returns False if there are
long-running tasks, no-worker, or queued tasks (due to not having any workers).
Not to be confused with :ivar:`idle`.
"""
return all(
count == 0 or state in {"memory", "error", "released", "forgotten"}
Expand Down Expand Up @@ -4338,7 +4341,7 @@ def update_graph(
keys=lost_keys, client=client, stimulus_id=stimulus_id
)

if not self.fully_idle and self.computations:
if not self.is_idle and self.computations:
# Still working on something. Assign new tasks to same computation
computation = self.computations[-1]
else:
Expand Down

0 comments on commit 0cf5145

Please sign in to comment.