开发者

Celery result.get times out

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.


Setting the result back-end fixed the problem

CELERY_RESULT_BACKEND = "amqp"
CELERY_AMQP_TASK_RESULT_EXPIRES = 1000 

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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜