关于python:Celery计划任务eta(apply_async(eta = xxx:23)选项不起作用

Celery scheduled task eta(apply_async(eta=xxx:23) option is not working

当我尝试使用eta选项安排芹菜任务时,未按预期的日期时间进行处理。

代码段:

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

settings.py代码段

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
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', '[email protected]'),

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'

这是芹菜输出日志,

1
2
3
4
5
6
7
[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参数始终具有过去的日期时间。尝试添加一些延迟(秒,分钟,所需的时间)或使用倒数参数