celery 4基类包装器引发 - TypeError:元类冲突

时间:2017-07-13 15:18:40

标签: python-3.x celery

我正在使用:Python 3.5,Celery 4.0.2

Celery网站的示例代码:

class CustomTask(Task):
def run(self):
print('running')
CustomTask = celery_app.register_task(CustomTask())

@celery_app.task(bind=True, base=CustomTask)
def custom(self):
print('running')

stacktrace的一部分:

celery_app.task(bind=True, base=CustomTask)
File "/home/xxx/Projects/nn/venv/lib/python3.5/site-packages/celery/app/base.py", line 416, in _create_task_cls
ret = self._task_from_fun(fun, **opts)
File "/home/xxx/Projects/nn/venv/lib/python3.5/site-packages/celery/app/base.py", line 454, in _task_from_fun
'wrapped': run}, **options))()
TypeError: metaclass conflict: the metaclass of a derived class must be a (non-strict) subclass of the metaclasses of all its bases

我做错了吗?

0 个答案:

没有答案