How to run celery on windows?

前端 未结 10 970
逝去的感伤
逝去的感伤 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:47

    Compile Celery with --pool=solo argument.

    Example: celery -A your-application worker -l info --pool=solo

    0 讨论(0)
  • 2020-11-27 16:52

    I have run celery task using RabbitMQ server. RabbitMq is better and simple than redis broker

    while running celery use this command "celery -A project-name worker --pool=solo -l info" and avoid this command "celery -A project-name worker --loglevel info"

    0 讨论(0)
  • 2020-11-27 16:57

    There are two workarounds to make Celery 4 work on Windows:

    • use eventlet, gevent or solo concurrency pool (if your tasks as I/O and not CPU-bound)
    • set the environment variable FORKED_BY_MULTIPROCESSING=1 (this is what actually causes the underlying billiard package to to fail under Windows since version 4)

    See https://www.distributedpython.com/2018/08/21/celery-4-windows for more details


    0 讨论(0)
  • 2020-11-27 16:57

    I've made a .bat file besides my manage.py file with this code:

    title CeleryTask
    ::See the title at the top.
    cd 
    cmd /k celery -A MainProject worker -l info
    

    so each time I want to run celery, I just double-click this batch file and it runs perfectly. And the fact that you can't use celery 4 on windows is true.

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