Celerybeat not executing periodic tasks
Asked Answered
L

2

18

How do you diagnose why manage.py celerybeat won't execute any tasks?

I'm running celerybeat via supervisord with the command:

/usr/local/myapp/src/manage.py celerybeat --schedule=/tmp/celerybeat-schedule-myapp --pidfile=/tmp/celerybeat-myapp.pid --loglevel=INFO

Supervisord appears to run celerybeat just fine, and the log file shows:

[2013-06-12 13:17:12,540: INFO/MainProcess] Celerybeat: Starting...
[2013-06-12 13:17:12,571: WARNING/MainProcess] Reset: Account for new __version__ field
[2013-06-12 13:17:12,571: WARNING/MainProcess] Reset: Account for new tz field
[2013-06-12 13:17:12,572: WARNING/MainProcess] Reset: Account for new utc_enabled field

I have several periodic tasks showing as enabled on http://localhost:8000/admin/djcelery/periodictask which should run every few minutes. However, the celerybeat log never shows anything being executed. Why would this be?

Laager answered 12/6, 2013 at 17:26 Comment(0)
G
27

celerybeat will just schecdule task, wont execute it. To execute task you need to also start worker. You can start celery beat as well as worker together. I use "celeryd -B"

In your case it should look like:

/usr/local/myapp/src/manage.py celery worker --beat --schedule=/tmp/celerybeat-schedule-myapp --pidfile=/tmp/celerybeat-myapp.pid --loglevel=INFO

or

/usr/local/myapp/src/manage.py celeryd -B --schedule=/tmp/celerybeat-schedule-myapp --pidfile=/tmp/celerybeat-myapp.pid --loglevel=INFO

Gooch answered 13/8, 2013 at 13:16 Comment(2)
Hey @Gooch - can you help here, I'm running celery beat via celery multi with --beat and --schedule options however no tasks are being executed. I tried decorating task with @app.periodic_task with CELERY_IMPORTS=("tasks",) but no success.Entrechat
You don't want to use -B, considering that docs.celeryproject.org/en/latest/userguide/… says: You can also embed beat inside the worker by enabling the workers -B option, this is convenient if you’ll never run more than one worker node, but it’s not commonly used and for that reason isn’t recommended for production use:Zipah
D
1

We recently upgraded from celery 4 to celery 5.

Apparently the -l flag has been removed, or re-named?

Works in celery4, but not celery 5:

celery -A pm -l info beat

Remove -l :

celery -A pm beat
Dissuasion answered 13/5, 2021 at 22:33 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.