1

I am getting unregistered error when i run the worker to take jobs from a queue. This is how i am doing

celery -A Tasks beat

The above command will schedule a job at specific time. After that, the task will be added to default queue.Now i run celery worker in other terminal as below

celery worker -Q default

But i am getting the following error

[2014-08-19 19:34:02,466: ERROR/MainProcess] Received unregistered task of type 'TasksReg.vodafone_v2'.
The message has been ignored and discarded.

Did you remember to import the module containing this task?
Or maybe you are using relative imports?
Please see http://bit.ly/gLye1c for more information.

The full contents of the message body was:
{'utc': False, 'chord': None, 'args': [[u'Kerala,Karnataka']], 'retries': 0, 'expires': None, 'task': 'TasksReg.vodafone_v2', 'callbacks': None, 'errbacks': None, 'timelimit': (None, None), 'taskset': None, 'kwargs': {}, 'eta': None, 'id': 'd4390336-9110-4e47-9e3a-017017cb509c'} (244b)
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/celery/worker/consumer.py", line 455, in on_task_received
    strategies[name](message, body,
KeyError: 'TasksReg.vodafone_v2'
Sandeep
  • 53
  • 1
  • 7

1 Answers1

-1

You should make sure the module that defines the task vodafone_v2 gets loaded by the celery worker.

You normally get that for free via task autodiscovery if you follow the suggested structure layout of your modules.

I guess this is not working because you start the worker without the -A Tasks parameter.

Perhaps you can try

celery -A Tasks worker -Q default -l info

Tommaso Barbugli
  • 11,781
  • 2
  • 42
  • 41
  • Fine dude, is it not possible to start the worker without -A tasks parameter like switching on the auto discovery of tasks. – Sandeep Aug 20 '14 at 09:52
  • @Sandeep not sure if you are making a point or a question, could you be bit more clear? – Tommaso Barbugli Aug 20 '14 at 11:48
  • Hi Tommaso, is it not possible to start the worker without -A tasks parameter like switching on the auto discovery of tasks ?? . How to do this. I hope u got my question – Sandeep Aug 21 '14 at 05:11
  • @Sandeep you need to tell celery where to find the Celery app instance; you can define your own task discovery logic in there eg. this will search task in module1.tasks and module2.tasks `app.autodiscover_tasks(lambda: ['module1', 'module2'])` – Tommaso Barbugli Aug 21 '14 at 07:16
  • thanks Tommaso. I will contact you if i have any doubts. – Sandeep Aug 21 '14 at 09:32