Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

celery beat doesn't work properly

when i run this command for celery beat.

[2013-06-27 02:17:05,936: INFO/MainProcess] Celerybeat: Starting...

[2013-06-27 02:17:05,937: INFO/MainProcess] Writing entries...

[2013-06-27 02:17:08,711: INFO/MainProcess] DatabaseScheduler: Schedule changed.

[2013-06-27 02:17:08,712: INFO/MainProcess] Writing entries...

it is stuck on this result. but in my settings.py I have configured the CELERYBEAT_SCHEDULE.

CELERYBEAT_SCHEDULER = "djcelery.schedulers.DatabaseScheduler"

from datetime import timedelta

CELERYBEAT_SCHEDULE = {
    'add-every-30-seconds': {
    'task': 'celerytest.tasks.add',
    'schedule': timedelta(seconds=30),
    'args': (16, 16)
    },

    'add-every-10-seconds': {
    'task': 'celerytest.tasks.minus',
    'schedule': timedelta(seconds=10),
    'args': (20, 16)
    },

}

What's wrong with my celery beat?

like image 360
user2357067 Avatar asked Jun 26 '13 14:06

user2357067


People also ask

How do you test celery beats?

Simplest way to check celery beat is running: ps aux | grep -i '[c]elerybeat' . If you get text string with pid it's running. Also you can make output of this command more pretty: ps aux | grep -i '[c]elerybeat' | awk '{print $2}' . If you get number - it's working, if you get nothing - it's not working.

What does celery purge do?

The celery purge program, used to delete messages from queues. Erase all messages from all known task queues. There's no undo operation for this command.

Why do you beat celery?

celery beat is a scheduler; It kicks off tasks at regular intervals, that are then executed by available worker nodes in the cluster. By default the entries are taken from the beat_schedule setting, but custom stores can also be used, like storing the entries in a SQL database.


1 Answers

The celery beat command starts the celery scheduler. This process schedules tasks and places them in a queue periodically. It does not execute tasks.

You need to start celery beat and celery worker (I guess you are using django-celery):

python manage.py celery beat
python manage.py celery worker

Or simply:

python manage.py celery worker --beat
like image 198
Artem Mezhenin Avatar answered Sep 22 '22 23:09

Artem Mezhenin