Celery error : result.get times out

后端 未结 4 875
既然无缘
既然无缘 2021-01-13 06:19

I\'ve installed Celery and I\'m trying to test it with the Celery First Steps Doc.

I tried using both Redis and RabbitMQ as brokers and backends, but I can\'t get th

4条回答
  •  醉酒成梦
    2021-01-13 06:58

    The 'backend' configuration can no longer be passed to the Celery object as an optional parameter, but should be passed through the python configuration parameter CELERY_RESULT_BACKEND (see https://github.com/celery/celery/issues/2146).

    So the tasks.py (from the Celery tutorial) should look something like:

    from celery import Celery
    
    app = Celery('tasks', broker='amqp://guest@localhost//')
    app.config_from_object('celeryconfig')
    
    @app.task
    def add(x, y):
        print '[' + str(x) + '][' + str(y) + ']=' + str(x+y)
        return x + y
    

    Create a file celeryconfig.py in the same directory as tasks.py with the following content:

    CELERY_RESULT_BACKEND='amqp://'
    

提交回复
热议问题