Skip to content

Conversation

@jakirkham
Copy link
Member

@jakirkham jakirkham commented Apr 28, 2021

There were some issues that surfaced when using the Cythonized Scheduler's dashboard with the recently added MemoryState class. One issue was around the use of object.__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

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.
@crusaderky
Copy link
Collaborator

Not sure I understand the rationale? What is it that Cython does not cope with?

@jakirkham
Copy link
Member Author

Please see the linked issue in the OP

Copy link
Member

@jrbourbeau jrbourbeau left a 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)

Copy link
Member

@jrbourbeau jrbourbeau left a 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

@jrbourbeau jrbourbeau merged commit 25cf4f3 into dask:main Apr 28, 2021
@jakirkham jakirkham deleted the cy_fixes_memst branch April 28, 2021 19:26
@jakirkham
Copy link
Member Author

Thanks James! 😄

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.

3 participants