celerybeat uses UTC even with timezone settings
-
25-06-2021 - |
Question
I'm finding that celerybeat is using UTC time in its scheduling (and outputting logs in UK time?!) even though I believe I have the required settings in my django settings.py:
TIME_ZONE = 'UTC'
USE_TZ = True
CELERY_ENABLE_UTC = True
CELERY_TIMEZONE = 'Australia/Sydney'
CELERYBEAT_SCHEDULE =
"testRunBeat" : {
"task" : "experiments.tasks.testHeartBeat",
"schedule" : crontab(minute = "*/1", hour="13-14"),
}
I have tried switching the TIME_ZONE variable with no luck
I am using:
django==1.4
celery==2.5.5
django-celery==2.5.5
Thanks
Solution
Turns out that it was a bug in celery which is now fixed. See https://github.com/celery/django-celery/issues/150
OTHER TIPS
I think that you want
CELERY_ENABLE_UTC = False
The celery configuration docs state pretty clearly that if this value is true, dates and times are converted to UTC. Also note this value is enabled by default since version 3.0.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow