I am sending a task like the below.....
from celery import Celery
celery = Celery()
celery.send_task('order_celery.order_worker', (order,))
From the worker log..this is what I get....
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/celery-3.1.7-py2.7.egg/celery/worker/consumer.py", line 445, in on_task_received
strategies[name](message, body,
KeyError: 'order_celery.order_worker'
here is my worker order_celery.py
from celery import Celery
app = Celery('tasks', broker='redis://%s:6379/0'%redis_host,backend='redis://%s:6379/0'%redis_host)
@app.task
def order_worker(order):
return True
Why will celery not work?
order_celery.py应该在您的PYTHONPATH中,您应该像这样运行worker:
celery -A order_worker worker --loglevel=info
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.