Reputation: 125
I followed the guide in setting up RabbitMQ, Installing Celery, and executing the file through the shell. Im now trying to learn how to preform periodic tasks, with the same file however no matter what I do I get this error: Both tasks/config are in the root.
[2015-07-02 07:56:33,928: ERROR/MainProcess] Received unregistered task of type
'tasks.scrape'.The message has been ignored and discarded.
File "/home/apps/django/env/local/lib/python2.7/site- packages/celery/worker/consumer.py", line 455, in on_task_received strategies[name](message, body,
KeyError: 'tasks.scrape'
tasks.py
from celery import Celery
app = Celery('tasks', backend='amqp', broker='amqp://guest@localhost//')
app.config_from_object('celeryconfig')
@app.task(name='scrape-odds')
def scrape(x,y):
return x + y
celeryconfig.py
from datetime import timedelta
from celery.schedules import crontab
CELERY_IMPORTS = ("tasks" )
CELERY_ENABLE_UTC = True
CELERY_TIMEZONE = 'UTC'
CELERYBEAT_SCHEDULE = {
'scrape-odds': {
'task': 'tasks.scrape',
'schedule': timedelta(seconds=30),
'args': (16, 16)
},
}
Upvotes: 0
Views: 93
Reputation: 599610
You've given your task a different name, for some reason: "scrape-odds". You should use that name.
Upvotes: 1