芹菜计划任务eta(apply_async(eta=xxx:23)选项不工作



当我尝试使用eta选项调度芹菜任务时,没有按照预期的日期时间处理。

代码片段:

 process_time_utc = datetime.datetime.fromtimestamp(time.mktime(x.utctimetuple()))
 process_request.apply_async(eta=process_time_utc,kwargs={'description':xxxx})

settings.py代码片段

CELERYBEAT_SCHEDULER = 'djcelery.schedulers.DatabaseScheduler'
CELERY_ENABLE_UTC = Flase
CELERY_ALWAYS_EAGER = False
CARROT_BACKEND = 'django'
BROKER_URL = 'amqp://user2:xxx@localhost:xx56//'
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = ()
# ('Your Name', 'your_email@example.com'),
CELERY_IMPORT = 'xxx.app.tasks'
MANAGERS = ADMINS
DATABASES = {'default': {
    'ENGINE': 'django.db.backends.sqlite3',
    'NAME': '/test_data/test.db',
    'USER': '',
    'PASSWORD': '',
    'HOST': '',
    'PORT': '',
}}

TIME_ZONE = 'UTC'

这是芹菜输出日志,

[2014-07-07 20:04:08,407: INFO/MainProcess] 
Got task from broker: xx.xxxx.app.tasks.process_request
[08029a2a-fdf0-4b50-b9a9-bdcf05ba71b5] eta:[2014-07-07 20:11:29+00:00]
[2014-07-07 20:04:48,785: INFO/MainProcess] 
Got task from broker: xx.xxxx.app.tasks.process_request
[624c5592-8ed6-4f2c-93df-d48af584a074] eta:[2014-07-07 20:06:29+00:00]

注意:我遵循这个教程http://celery.readthedocs.org/en/latest/reference/celery.app.task.html

Eta参数总是有一个过去的日期时间。尝试添加一些延迟(秒,分,你需要的)或使用倒计时参数

最新更新