How to run celery on windows?

前端 未结 10 1020
逝去的感伤
逝去的感伤 2020-11-27 16:13

How to run celery worker on Windows without creating Windows Service? Is there any analogy to $ celery -A your_application worker?

10条回答
  •  无人及你
    2020-11-27 16:40

    After feeling like killing myself by using celery 4.4 on windows, I think I can answer this question.

    For celery version 4.0 and above, first set following environment variable in python code before creation of celery instance.

    os.environ.setdefault('FORKED_BY_MULTIPROCESSING', '1')
    

    Then run celery worker command with default pool option.

    celery worker -A  -l info
    

    This will run celery worker concurrently with multiple child processes.

    Note: When you run celery with gevent or eventlet pool, it will work but it won't run concurrent processes on windows.

提交回复
热议问题