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

后端 未结 3 857
甜味超标
甜味超标 2020-12-03 06:05

I\'ve been trying to follow the Celery First Steps With Celery and Next Steps guides. My setup is Windows 7 64-bit, Anaconda Python 2.7 (32-bit), Installed Erlang 32-bit bi

相关标签:
3条回答
  • 2020-12-03 06:49

    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
    
    0 讨论(0)
  • 2020-12-03 06:51

    .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()
    
    0 讨论(0)
  • 2020-12-03 07:04
    • 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

    0 讨论(0)
提交回复
热议问题