Typehint and documentation for Future.status
Added some type hinting for distributed.client.FutureState.status and the distributed.client.Future.status property that returns it.
Updated the docstring of Future.status to also include these states. The type hint has to include None as an option as technically the state may not be set until _bind_late() runs. I have mentioned this in the docstring currently; this may be an unlikely case that doesn't make sense to include in the docstring. I have enabled the allow edits by maintainers option so feel free to remove the None case from the docstring.
No mypy errors are raised on existing code which sets the state so I believe all the options are captured in the Literal.
With these changes, the API section of the documentation now mentions the possible statuses both from the hints and from the docstring.
Closes #9157
- [ ] ~~Tests added / passed~~
- [x] Passes
pre-commit run --all-files
Failures in the pre-commit check are mypy errors from files not touched by this PR.
Link to property in built API docs: https://distributed--9158.org.readthedocs.build/en/9158/api.html#distributed.Future.status
Unit Test Results
See test report for an extended history of previous test failures. This is useful for diagnosing flaky tests.
27 files ±0 27 suites ±0 10h 4m 0s ⏱️ + 22m 2s 4 112 tests ±0 4 006 ✅ +3 104 💤 ±0 2 ❌ - 3 51 516 runs ±0 49 330 ✅ +3 2 184 💤 ±0 2 ❌ - 3
For more details on these failures, see this check.
Results for commit a66058b0. ± Comparison against base commit 1a1953d7.
I've opened #9159 to resolve the unrelated mypy issues.