Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

celerybeat uses UTC even with timezone settings

Tags:

celerybeat

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

like image 928
Trent Avatar asked Aug 07 '12 14:08

Trent


2 Answers

Turns out that it was a bug in celery which is now fixed. See https://github.com/celery/django-celery/issues/150

like image 113
Trent Avatar answered Sep 24 '22 23:09

Trent


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.

like image 33
Mark Chackerian Avatar answered Sep 24 '22 23:09

Mark Chackerian