Skip to content

Conversation

@jakirkham
Copy link
Member

Analogous to PR ( #4290 ) except instead of ClientState, this is annotating WorkerState and usages thereof. This is a bit longer simply because of how many attributes WorkerState has. That said, this just uses the same strategy here as was used for ClientState.

@jakirkham jakirkham changed the title Annotate WorkerState for Cythonization [WIP] Annotate WorkerState for Cythonization Dec 2, 2020
@jakirkham jakirkham marked this pull request as draft December 2, 2020 04:22
@jakirkham jakirkham force-pushed the cy_ws branch 4 times, most recently from 853da21 to ceaae08 Compare December 2, 2020 06:22
@jakirkham jakirkham force-pushed the cy_ws branch 2 times, most recently from ef11ffd to b0764f5 Compare December 2, 2020 07:02
@jakirkham jakirkham force-pushed the cy_ws branch 2 times, most recently from d4c8a9c to adba1ba Compare December 2, 2020 20:31
@jakirkham jakirkham changed the title [WIP] Annotate WorkerState for Cythonization Annotate WorkerState for Cythonization Dec 2, 2020
@jakirkham jakirkham marked this pull request as ready for review December 2, 2020 20:34
@jakirkham
Copy link
Member Author

This is ready for review!

cc @mrocklin @quasiben

@jakirkham jakirkham force-pushed the cy_ws branch 5 times, most recently from 0b338b3 to 91f636c Compare December 3, 2020 22:16
@jakirkham jakirkham force-pushed the cy_ws branch 3 times, most recently from efa24e1 to a069e21 Compare December 3, 2020 22:43
Typically `bandwidth` seems to be a `float` elsewhere in the code. So
coerce it to a `float` here as well to align with that practice.
Avoids confusion with the variable name used outside this closure. Also
bypasses any potential leakage from the external scope.
Since these are effectively private given they are only available in
Cython/C, go ahead and mark them as such. We can then add Python
`@property`s on top of them to handle Python access to the original
attribute names with minimal disruption.
Includes `setter`s for `occupancy` and `nbytes`.
This ensures Cython still uses `WorkerState` to annotate the variable
iterated over. Otherwise it constructs a generator with its own scope
where this is ignored.
Apparently `_name` is sometimes an `int`. So relax typing around it to
just an `object`.
_local_directory: str
_memory_limit: Py_ssize_t
_metrics: dict
_name: object
Copy link
Member Author

Choose a reason for hiding this comment

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

This is an object as it could be a str or an int. See discussion in PR ( #4296 ) for more context.

@jakirkham jakirkham requested a review from mrocklin December 4, 2020 01:18
@mrocklin mrocklin merged commit 5d08663 into dask:master Dec 4, 2020
@mrocklin
Copy link
Member

mrocklin commented Dec 4, 2020

This is in. Thanks @jakirkham

@jakirkham
Copy link
Member Author

Thanks Matt! 😄

@jakirkham
Copy link
Member Author

Found a couple minor things that needed fixing. Submitted as PR ( #4321 ).

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