You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I want to use a custom Dask serializer/deserializer with jitclass, but at the moment it is not possible because the type() of jitclass instance returns a type object with __module__ set to numba.experimental.jitclass.boxing.
distributed.protocol.pickle - ERROR - Failed to serialize <numba.experimental.jitclass.boxing.Example object at 0x7fe4ed1cdcc0>.
Traceback (most recent call last):
File "/home/egor/.cache/pypoetry/virtualenvs/forctool-5SrdLVXS-py3.10/lib/python3.10/site-packages/distributed/protocol/pickle.py", line 63, in dumps
result = pickle.dumps(x, **dump_kwargs)
TypeError: cannot pickle 'Example' object
And if I register serializer for the instance type, Dask fails to pickle this type object because there is no such class in numba.experimental.jitclass.boxing module:
_pickle.PicklingError: Can't pickle <class 'numba.experimental.jitclass.boxing.Example'>: attribute lookup Example on numba.experimental.jitclass.boxing failed
Workaround
I managed to get it working by manually injecting a class into numba.experimental.jitclass.boxing module and using a modification of dask serializer that recovers the original class type and allows Dask to dispatch correctly:
Feature request
I want to use a custom Dask serializer/deserializer with jitclass, but at the moment it is not possible because the
type()
of jitclass instance returns a type object with__module__
set tonumba.experimental.jitclass.boxing
.If I register serializer for the class type, as shown in documentation, Dask can not find it when serializing an instance and using an instance type:
And if I register serializer for the instance type, Dask fails to pickle this type object because there is no such class in
numba.experimental.jitclass.boxing
module:Workaround
I managed to get it working by manually injecting a class into
numba.experimental.jitclass.boxing
module and using a modification ofdask
serializer that recovers the original class type and allows Dask to dispatch correctly:Usage:
But I think that it needs to be fixed in Numba by passing a real module path from a jitclass decorator to the instances.
The text was updated successfully, but these errors were encountered: