5

所以我正在使用虚拟机(流浪者)进行开发,当我在其中启动 celery beat 时收到此消息:

[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]

当我在里面约会时,我得到了一个Tue Jul 15 09:25:11 UTC 2014,但问题是我住在葡萄牙,而我的主机给了我Ter Jul 15 10:25:39 WEST 2014

我解决这个问题的最佳方法是什么?

当我把这个直播的时候呢?

我正在使用celery 3.1.12,我没有CELERY_TIME_ZONE一套。

4

2 回答 2

1

好吧,有时做所有的 django 设置无济于事。原因是实例或本地的本地时间不正确(甚至几秒钟)

确保多个实例之间的时间相同(例如我的 ec2 和 digitalocean)

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

以上将确保时间同步

如上所述,在此之后,我在 Django 中使用以下内容

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

# For celery
CELERY_ENABLE_UTC = True

我正在使用以下pip freeze

django-celery==3.1.16
Django==1.6
celery==3.1.8
于 2015-10-24T21:12:15.377 回答
0

这通常表示时区不匹配。请注意,漂移是 3600 秒 = 正好是一小时。

要设置的 celery 变量是CELERY_TIMEZONE,不是CELERY_TIME_ZONE

于 2015-05-07T13:26:36.550 回答