How do I stop celery from converting my custom classes into dictionaries?

21 views Asked by At

I have a class instance I am trying to pass over to celery task, However when I do so celery converts it to a class dict. I need to the instance to remain the instance and not get converted into a dict. The class is used for our config attributes. It allows us to reference attributes in nested instances so I dont need to use python's dict referencing.

Instead of having to reference an attribute like this: config["project"]["attr"]["thing"] I can reference it like this config.project.attr.thing

I have read about how Celery does this because of its serializer. I tried setting the following, but it didn't change anything. What actually happened was it wouldn't accept any content as if it didn't know what ['pickle'] was.

task_serializer = 'pickle'
result_serializer = 'pickle'
accept_content = ['pickle']

I also read this post, but it did not help: how do you configure `celery` to use serializer 'pickle'?

How can I stop celery from messing with my class instances as input?

0

There are 0 answers