-
-
Notifications
You must be signed in to change notification settings - Fork 748
Cython fixes for MemoryState
#4761
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
Conversation
Cython complains if we use `object.__new__` here. Besides this class is marked `final`. So there is no other inheritance. Thus this can just use `MemoryState` directly for object creation.
As Cython attributes don't support access through `getattr`, this code doesn't really work in Cython. So just do a simple `for`-loop and spell out each attribute that is being added.
For some reason these additional decorators create properties that don't behave particularly well in Cython. Instead of being able to access the property as expected, we see exceptions about `builtin_function_or_method`. Admittedly there may be a Cython bug involved. However things like `ccall` don't make much sense when applied to a `property` (as it shouldn't create a Python and C function for it). Same story with `inline` (though we can just access the `_*` name for this affect). `nogil` may make sense for the code itself. However `@property` access does involve some Python GIL using code. So it's probably best to drop it as well.
c65066b to
68cbb06
Compare
|
Not sure I understand the rationale? What is it that Cython does not cope with? |
|
Please see the linked issue in the OP |
jrbourbeau
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the updates here @jakirkham. I tried this PR out locally and can confirm it resolves #4760
Let's handle making sure CI is cythonizing properly in a separate PR (xref #4764)
jrbourbeau
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's merge this in after CI finishes
|
Thanks James! 😄 |
black distributed/flake8 distributed/isort distributedThere were some issues that surfaced when using the Cythonized Scheduler's dashboard with the recently added
MemoryStateclass. One issue was around the use ofobject.__new__. However fixing that led to other issues. This fixes them basically until the reproducer in the issue linked above is able to render the dashboard.cc @crusaderky @jrbourbeau @quasiben