How to start a Celery worker from a script/module __main__?

前端 未结 5 852
离开以前
离开以前 2020-12-13 07:07

I\'ve define a Celery app in a module, and now I want to start the worker from the same module in its __main__, i.e. by running the module with

5条回答
  •  执笔经年
    2020-12-13 07:48

    worker_main was put back in celery 5.0.3 here: https://github.com/celery/celery/pull/6481

    This worked for me on 5.0.4:

    self.app.worker_main(argv = ['worker', '--loglevel=info', '--concurrency={}'.format(os.environ['CELERY_CONCURRENCY']), '--without-gossip'])
    

提交回复
热议问题