[Fixed]-Some Celery tasks work, others are NotRegistered

12đź‘Ť

âś…

This might hopefully help someone.
I had modified my code and neglected to restart the celery worker.

Try restarting the celery workers.

👤karuhanga

6đź‘Ť

The error is because CELERY_IMPORTS setting is not working properly into your etl/settings/base.py file.
So my suggestion is :

Remove the comma from

CELERY_IMPORTS = ('pipeline.tasks' , )

And if the issue still persists,then run this command :

celery -A pipeline.tasks worker --loglevel=DEBUG

One more thing, your tasks.py file needs to be in a Django app (that’s registered in settings.py) in order to be imported.So check this point also.Thanks.

2đź‘Ť

Relative imports and automatic name generation don’t go well together, so if you’re using relative imports you should set the name explicitly.

For example if the client imports the module “myapp.tasks” as “.tasks”, and the worker imports the module as “myapp.tasks”, the generated names won’t match and an NotRegistered error will be raised by the worker.

http://docs.celeryproject.org/en/latest/userguide/tasks.html#task-naming-relative-imports

👤Toanalien

1đź‘Ť

I had this issue recently. An import error was causing the task to not be registered correctly. It was failing silently, so I had no way knowing that the task registration failure was being caused by the import error. Hopefully this can help out someone who is stuck with tasks not registering in celery.

👤briancaffey

Leave a comment