celery beat schedule with timezone configuration doesn't start at the the right time

Viewed 2197

python version: 3.5.2 celery version: 4.1.0

server local timezone: Asia/Beijing Timezone +08:00 CST

celery settings:

timezone = "Asia/Shanghai"

beat_schedule = {
    "test.hello": {
        "task": "test.hello",
        "args": (),
        "schedule": crontab(minute=55, hour=22, day_of_week="Mon,Tue,Wed,Thu,Fri")
    },

}

but celery beat run the tasks start in 2017-08-02 07:01:00 CST,

actually the task should start at 2017-08-01 22:55:00 +08:00.

2 Answers

I was getting an error where timezone was not updating even after changing it .

Use this to set your timezone other than UTC .

CELERY_TIMEZONE = 'Asia/Shanghai' # write your timezone
app.conf.enable_utc = False

This solution worked for me

Related