1

输入:

>>> from registration import tasks
>>> tasks.mail.delay()
<AsyncResult: 36a2e61c-493b-472c-99f1-cb2391110aa9>
>>> r=tasks.mail.delay()
>>> r.ready()

输出:

Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File "/usr/local/lib/python2.6/dist-packages/celery/result.py", line 174, in ready
        return self.state in self.backend.READY_STATES
      File "/usr/local/lib/python2.6/dist-packages/celery/result.py", line 277, in state
        return self.backend.get_status(self.id)
      File "/usr/local/lib/python2.6/dist-packages/celery/backends/base.py", line 487, in _is_disabled
        raise NotImplementedError('No result backend configured.  '
    NotImplementedError: No result backend configured.  Please see the documentation for more information.

我如何配置后端,以便我可以修复特定的延迟时间

4

1 回答 1

3

如果您使用 celeryconfig.py 配置模块,则可以通过 CELERY_RESULT_BACKEND 设置配置结果后端

CELERY_RESULT_BACKEND="amqp"

或通过 Celery 实例

celery = Celery('tasks', backend='amqp', broker='amqp://')

请查看文档以获取更多信息。

于 2012-07-31T07:36:25.230 回答