Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Django celery beat Substantial drift from warning message

So i am developing using a VM (vagrant) and i am getting this message when i start celery beat inside it:

[2014-07-15 10:16:49,627: INFO/MainProcess] beat: Starting...
[W 140715 09:16:51 state:74] Substantial drift from celery@worker_publications may mean clocks are out of sync.  Current drift is
    3600 seconds.  [orig: 2014-07-15 09:16:51.476125 recv: 2014-07-15 10:16:51.474109]

[W 140715 09:16:51 state:74] Substantial drift from celery@worker_queue may mean clocks are out of sync.  Current drift is
    3600 seconds.  [orig: 2014-07-15 09:16:51.480642 recv: 2014-07-15 10:16:51.475021]

When i do date inside it i get a Tue Jul 15 09:25:11 UTC 2014 but the thing is i live in Portugal and my host machine gives me Ter Jul 15 10:25:39 WEST 2014.

Whats the best approach for me to fix this?

What about when i put this live?

I am using celery 3.1.12 and i do not have a CELERY_TIME_ZONE set.

like image 927
psychok7 Avatar asked Nov 10 '22 04:11

psychok7


1 Answers

Well sometimes doing all the django setting will not help. The reason is that the local time on the instance or local is not correct ( even by some seconds)

To make sure the time is same between multiple instances (example for me ec2 and digitalocean)

sudo apt-get install ntp
sudo /etc/init.d/ntp restart

The above will make sure the time is in sync

After this as mention above, I use the following in Django

TIME_ZONE = 'America/Los_Angeles'
TZINFO = 'UTC'
USE_TZ = True

# For celery
CELERY_ENABLE_UTC = True

I am using the following pip freeze

django-celery==3.1.16
Django==1.6
celery==3.1.8
like image 170
Anuj Acharya Avatar answered Nov 15 '22 09:11

Anuj Acharya