How to debug Celery/Django tasks running locally in Eclipse
You should consider the option to run the celery task in the same thread as the main process (normally it runs on a separate process), this will make the debug much easier.
You can tell celery to run the task in sync by adding this setting to your settings.py module:
CELERY_TASK_ALWAYS_EAGER = True# use this if you are on older versions of celery# CELERY_ALWAYS_EAGER = True
Note: this is only meant to be in use for debugging or development stages!
CELERYD_POOL defaults to celery.concurrency.prefork:TaskPool
which will spawn separate processes for each worker and PyDev can't see inside them. If you change it to one of the threaded options then you can use the debugger.
For example, for Celery 3.1 you can use this setting:
CELERYD_POOL = 'celery.concurrency.threads:TaskPool'
Note that this requires the threadpool module to be installed.
Also make sure to have CELERY_ALWAYS_EAGER = False
, otherwise changing the pool class makes no sense.