The Pymongo collection object fails when I try to start my tasks with celery. I guess he could not serialize it. What should I do? By the way, I tried to pickle, but it does not help me.
PS: I do not want to import global db into this module.
Collection cannot be called. If you intended to call the getnewargs method.
The following is sample code. module.py
from celery.contrib.methods import task_method class Some_Class(object): """docstring for Some_Class""" def __init__(self, db): super(Some_Class, self).__init__() self.db = db
db.py
from pymongo import MongoClient db = MongoClient()['test']['collection']
python serialization pymongo pickle celery
fatihsucu
source share