Search code examples
celerycelerybeat

celery beat timezone problems


So, I have been using celery/beat for a number of years, and have been ofsetting manually, the schedule of my tasks due to DST issues etc. As my codebase has become larger, the script that I run to change the times is getting bigger and bigger, and I have decided to sort the problem out.

So in short, my system clock updates automatically, from my shell I can run:

┌─[luke@freebsd] - [~/py3-apps/intranet] - [Thu Mar 29, 12:24]
└─[$]> date
Thu Mar 29 12:37:22 BST 2018

So presently I have a task to run at 10:30am, it will run at 11:30am. So I thought this would be easy, I added the following to my configuration:

CELERY_TIMEZONE = Europe/London
CELERY_ENABLE_UTC = False

When I run my celery beat schedule, via:

celery worker --beat -A pyramid_celery.celery_app --ini development.ini -n celeryIntranetAPI

Now I thought this would solve my problems, however my cron tasks are still an hour behind, how can I make celery keep up with the system clock?

Note I have tried:

CELERY_TIMEZONE = UTC          
CELERY_ENABLE_UTC = True

As per a few suggestions, but this did not work either.

Can anyone can shed some light on how I can link my celery cron timings to the system clock?

This was fixed in celery here: https://github.com/celery/celery/commit/be55de622381816d087993f1c7f9afcf7f44ab33


Solution

  • Turns out this was a bug with celery, fixed here