簡體   English   中英

Celery計划任務eta(apply_async(eta = xxx:23)選項不起作用

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

當我嘗試使用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參數始終具有過去的日期時間。 嘗試添加一些延遲(秒,分鍾,所需的時間)或使用countdown參數

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM