[Fixed]-When calling async task celery is raising Exception : "NameError: global name * is not defined"

2👍

You will need to restart your worker in order to see changes to your files reflected in your worker instances. Celery does not monitor for file changes, so if you change any of the files while your workers are running you will need to restart the workers.

For development purposes this can be sidestepped by using the auto reloading feature:

When auto-reload is enabled the worker starts an additional thread that watches for changes in the file system. New modules are imported, and already imported modules are reloaded whenever a change is detected, and if the prefork pool is used the child processes will finish the work they are doing and exit, so that they can be replaced by fresh processes effectively reloading the code.

This is an experimental feature and should only be used in development environments

-1👍

As @grrrrrr suggested restarting the celery worker fixes the issue. In my case celery worker is run by supervisor so I had to restart supervisor.

Leave a comment