1
我試圖重試失敗,下面的代碼一個任務:芹菜 - 任務重試導致奇怪的錯誤
@task(bind=True)
def update_listing(self, listing_object, retailer):
try:
listing = _update_listing(listing_object, retailer)
except Exception as exc:
raise self.retry(exc=exc)
return listing
這導致以下錯誤被拋出:
Reject: (TypeError('__init__() takes exactly 2 arguments (3 given)',), True)
我可以這個錯誤與什麼有關,或者我如何解決它。我是否以正確的方式調用重試方法?
我芹菜配置文件看起來像這樣:
BROKER_URL = "redis://localhost:6379/0"
CELERY_IMPORTS = ("tasks",)
CELERY_RESULT_BACKEND = "redis://localhost:6379/0"
CELERY_IGNORE_RESULT = True
編輯:全堆棧跟蹤:
Traceback (most recent call last):
File "/home/my-project/venv/local/lib/python2.7/site-packages/celery/app/trace.py", line 218, in trace_task
R = retval = fun(*args, **kwargs)
File "/home/my-project/venv/local/lib/python2.7/site-packages/celery/app/trace.py", line 398, in __protected_call__
return self.run(*args, **kwargs)
File "/home/my-project/tasks.py", line 156, in update_listing
raise self.retry(exc=exc)
File "/home/my-project/venv/local/lib/python2.7/site-packages/celery/app/task.py", line 666, in retry
raise Reject(exc, requeue=True)
Reject: (TypeError('__init__() takes exactly 2 arguments (3 given)',), True)
我使用「應用程序試圖「語法,但我仍然遇到同樣的問題:( – Hanpan
什麼應用語法..我不明白...我說使用'從celery.contrib.methods導入任務'而不是'從芹菜導入任務','或者使用常規函數而不是類內的方法。 – securecurve