Celery 'Getting Started' not able to retrieve results; always pending

拟墨画扇 提交于 2019-11-27 14:12:32
  • W8 x64
  • Python 2.7.3 (ActivePython)
  • Erlang 17.1 x64
  • RabbitMQ server 3.3.5
  • Celery 3.1.13

Randomly stopped working too. Exact same problem - forever pending. Reinstalling Erlang or RabbitMQ didn't help.

I tested also on Debian Linux 7 x86 and here it's working fine without problems.

Also: https://github.com/celery/celery/issues/2146

It's propably Windows related problem and setting worker flag --pool=solo fixed it for me ATM

.delay methods puts your task in queue. "result.state" is showing pending, which means your task in not yet executed. There might be a lot tasks, so its getting delayed.

Check if there are any tasks running

>>> from celery.task.control import inspect
>>> i = inspect()
>>> i.scheduled()
>>> i.active()

You must add track_started=True. Well, it's hard to know this option.

The default value is False, so you will always get PENDING when the task is not finished. Besides, you must config wrong on backend or broker. Plz check them again.

@app.task(bind=True, track_started=True)
def add(x, y):
    return x + y
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!