Reputation: 101
When I try to schedule the celery task using eta option, is not processing as expected date time.
Code Snippet:
process_time_utc = datetime.datetime.fromtimestamp(time.mktime(x.utctimetuple()))
process_request.apply_async(eta=process_time_utc,kwargs={'description':xxxx})
settings.py code snippet
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'
Here is the celery output log,
[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]
Note: I have followed this tutorial http://celery.readthedocs.org/en/latest/reference/celery.app.task.html
Upvotes: 3
Views: 3744
Reputation: 5193
Eta parameter always has a past datetime. Try to add some delay (seconds, minutes, what you need) or use the countdown parameter
Upvotes: 2