celery / celery

Distributed Task Queue (development branch)
https://docs.celeryq.dev
Other
24.88k stars 4.67k forks source link

HttpDispatchTask throwing NotRegistered error on celery consumer V 2.4.5 #560

Closed shivanshtyagi closed 12 years ago

shivanshtyagi commented 12 years ago

I have been using celery for a while, recently i upgraded to version 2.4.5 from 2.1.3 and when i try to do the following on python shell

from celery.task.http import HttpDispatchTask resp = HttpDispatchTask.apply_async(None, {'url': 'http://example.com', 'method':'GET'}, routing_key='rout_key')

on the consumer side I see the following error -------

[2011-12-08 03:24:21,326: ERROR/MainProcess] Received unregistered task of type 'celery.task.http.HttpDispatchTask'. 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: {'retries': 0, 'task': 'celery.task.http.HttpDispatchTask', 'args': [], 'expires': None, 'eta': None, 'kwargs': {'url': 'http://example.com', 'method': 'GET'}, 'id': 'b0d6a13f-a719-499f-a44e-a1de6e7621dc'} Traceback (most recent call last): File "/usr/local/lib/python2.6/dist-packages/celery/worker/consumer.py", line 427, in receive_message eventer=self.event_dispatcher) File "/usr/local/lib/python2.6/dist-packages/celery/worker/job.py", line 297, in from_message on_ack=on_ack, delivery_info=delivery_info, kw) File "/usr/local/lib/python2.6/dist-packages/celery/worker/job.py", line 261, in init self.task = registry.tasks[self.task_name] File "/usr/local/lib/python2.6/dist-packages/celery/registry.py", line 66, in getitem** raise self.NotRegistered(key) NotRegistered: 'celery.task.http.HttpDispatchTask'

I can see the the entry 'celery.task.http.HttpDispatchTask': <@task: celery.task.http.HttpDispatchTask > in celery.registry.tasks , but still the consumer claims that its an unregistered task.

shivanshtyagi commented 12 years ago

As soon as I went back to 2.1.3 everything works fine

ask commented 12 years ago

On 8 Dec 2011, at 05:21, phoenix01 wrote:

I have been using celery for a while, recently i upgraded to version 2.4.5 from 2.1.3 and when i try to do the following on python shell

from celery.task.http import HttpDispatchTask resp = HttpDispatchTask.apply_async(None, {'url': 'http://example.com', 'method':'GET'}, routing_key='rout_key')

on the consumer side I see the following error -------

[2011-12-08 03:24:21,326: ERROR/MainProcess] Received unregistered task of type 'celery.task.http.HttpDispatchTask'. The message has been ignored and discarded.

I can see the the entry 'celery.task.http.HttpDispatchTask': <@task: celery.task.http.HttpDispatchTask > in celery.registry.tasks , but still the consumer claims that its an unregistered task.

The contents of celery.registry.tasks on the client is not necessarily the same as the worker's.

It seems that this may be a bug, in the meantime you can register it yourself by adding:

CELERY_IMPORTS = ("celery.task.http", )

or starting celeryd with:

 celeryd -I celery.task.http

(the above is uppercase i)

Ask Solem twitter.com/asksol | +44 (0)7713357179

shivanshtyagi commented 12 years ago

Thanks for the help Solem, i'll try the solution, though the client and worker are running on the same machine so cant think how it can be possible that celery.tasks.registry is different, sounds like a bug to me.

ask commented 12 years ago

On 8 Dec 2011, at 13:14, phoenix01 wrote:

Thanks for the help Solem, i'll try the solution, though the client and worker are running on the same machine so cant think how it can be possible that celery.tasks.registry is different, sounds like a bug to me.

celery.registry.tasks is local to every process, it is not shared across clients and workers.

Ask Solem twitter.com/asksol | +44 (0)7713357179