Celery result.get 超时
我有两个不同的 django 项目,分别是 projA
和 projB
,每个项目都有自己的 celery 守护进程在不同的队列上运行,但相同的虚拟主机,projA 有一个任务 taskA
> 和 projB 有一个任务 taskB
,我尝试从 taskA
内部运行 taskB
例如,
@task(routing_key='taskA')
def taskA(event_id):
# do some work , then call taskB and wait for result
result = send_task('taskB',routing_key='taskB')
res = result.get(timeout=20)
我可以在 projB 的日志中看到 taskB 在 a 内完成第二,但taskA继续等待结果并在20秒后超时
对于后端我有rabbitmq。
I have two different django projects say projA
and projB
, each have its own celery daemon running on separate queues but same vhost, projA have a task taskA
and projB have a task taskB
, I try to run taskB
from inside taskA
e.g.
@task(routing_key='taskA')
def taskA(event_id):
# do some work , then call taskB and wait for result
result = send_task('taskB',routing_key='taskB')
res = result.get(timeout=20)
I can see in logs of projB that taskB finished within a second, but taskA keeps on waiting for result and times out after 20 seconds
For backend I have rabbitmq.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
设置结果后端解决了问题
IMO 如果未设置结果后端 result.get 应该抛出错误或至少记录警告
尽管 celery 2.3 确实会抛出错误,如此处所述 https://github.com/ask/django-celery/issues/66
Setting the result back-end fixed the problem
IMO if result back-end is not set result.get should throw error or at-least log a warning
Though celery 2.3 does throw error as described here https://github.com/ask/django-celery/issues/66