celerybeat - multiple instances & monitoring

前端 未结 3 1861
长情又很酷
长情又很酷 2021-02-05 21:15

I\'m having application built using celery and recently we got a requirement to run certain tasks on schedule.

I think celerybeat is perfect for this, but I got few ques

3条回答
  •  青春惊慌失措
    2021-02-05 21:37

    To answer your 2 questions:

    1. If you run several celerybeat instances you get duplicated tasks, so afaik you should have only single celerybeat instance.

    2. I'm using supervisord as you mentioned to run celery workers and celerybeat workers as deamon so they should always be up & running.

    my supervisord config:

    [program:my_regular_worker]
    command=python2.7 /home/ubuntu/workspace/src/manage.py celery worker -Q my_regular_worker-queue_name -c 1 -l info --without-mingle
    process_name=my_regular_worker
    directory=/home/ubuntu/workspace/src
    autostart=true
    autorestart=true
    user=ubuntu
    stdout_logfile=/tmp/my_regular_worker.log
    redirect_stderr=true
    
    
    
    [program:my_celerybeat_worker]
    command=python2.7 /home/ubuntu/workspace/src/manage.py celery worker -Q my_celerybeat_worker-queue_name -c 1 -l info --without-mingle -B -s /tmp/celerybeat-schedule
    

提交回复
热议问题