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

Review scheduler annotations, part 2 #6253

Merged
merged 5 commits into from
May 11, 2022

Conversation

crusaderky
Copy link
Collaborator

@crusaderky crusaderky commented May 1, 2022

Continues from #6132

Out of scope:

  • SchedulerState
  • Scheduler
  • A bunch of non-None attributes in TaskState that are forced to None in TaskState.__init__
  • Change TaskState.state to a Literal

@crusaderky crusaderky self-assigned this May 1, 2022
self._state: str = None # type: ignore
self.exception: str = None # type: ignore
self.exception_blame: TaskState = None # type: ignore
self._state = None # type: ignore
Copy link
Collaborator Author

@crusaderky crusaderky May 1, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The cleanup of these non-None attributes forced to None is left to a future PR

type(ws),
ws,
)
if self.validate and ws is not None:
assert ws.address in self.workers
Copy link
Collaborator Author

@crusaderky crusaderky May 1, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The top-level function decide_workers NEVER returns None in the unit tests.
Follow-up: #6254

@github-actions
Copy link
Contributor

github-actions bot commented May 1, 2022

Unit Test Results

       16 files  ±    0         16 suites  ±0   7h 41m 24s ⏱️ + 50m 52s
  2 767 tests  -     2    2 689 ✔️ +    2       78 💤  -   3  0  - 1 
22 098 runs  +276  21 080 ✔️ +259  1 018 💤 +19  0  - 2 

Results for commit e51734f. ± Comparison against base commit e390609.

♻️ This comment has been updated with latest results.

@crusaderky crusaderky marked this pull request as ready for review May 1, 2022 13:36
@crusaderky
Copy link
Collaborator Author

All failures are unrelated

@crusaderky crusaderky force-pushed the scheduler_annotations branch from df1cee3 to a4ae52a Compare May 6, 2022 21:46
Copy link
Member

@hendrikmakait hendrikmakait left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall LGTM. I think there are a few more annotations we can drop while we're at it, but feel free to ignore these (as well as my nit-picking and meta-comment):

old_nbytes: int = self.nbytes

deps: list = list(ts.dependents)

w: str = ws.address

if finish == "memory" or finish == "erred":
ts: TaskState = self.scheduler.tasks.get(key)
ts = self.scheduler.tasks.get(key)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a comment outside of the scope of this review: ts appears to be a common abbreviation for task_state. When I hear ts I automatically think timestamp, I'm not sure if anybody else has this problem and if it creates friction. If so, it might be worth thinking about renaming ts variables to task_state.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, we ubiquitously intend ts as TaskState and ws as WorkerState
"ts" as timestamp should be avoided in distributed.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alright, so it'll just take some getting used to :)

distributed/scheduler.py Outdated Show resolved Hide resolved

@property
def state(self) -> str:
"""This task's current state. Valid states include ``released``, ``waiting``,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this docstring! Without it, it has been extremely hard for me to understand what possible states a TaskState could be in.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm going to replace str with a TaskStateState Literal in a later PR, like it's already done in worker_state_machine.py

crusaderky and others added 3 commits May 11, 2022 13:22
@crusaderky crusaderky merged commit a4999a9 into dask:main May 11, 2022
@crusaderky crusaderky deleted the scheduler_annotations branch May 11, 2022 14:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants