Debug Celery Tasks

anybody figured out how to debug celery tasks inside PyCharm or IntelliJ? I could find a single, really old thread that is not giving too much details about it.

i tried running celery through my project and when i run this in debug mode everything seems to be working, with the exception that none of my breakpoints are getting hit. any idea why? i was hoping that anything in the run PYTHONPATH that has a breakpoint will stop
hmm, I think I've had this work before; generally things you can set up as a Python run configuration (which includes or bin/celery) should be debuggable. Maybe some pool types throw it off, if the debugger doesn't follow through to the child processes?

The other thing you can try is use the Remote Debug feature. Start pycharm's Python Remote Debug, and then drop that pydevd.settrace line somewhere you know the celery worker process will hit it.
i tried both (set up a Python run configuration or remote debug with pydevd.settrace) and they don't work. it seems to be that was happens is what you said, the debugger doesn't follow through to the child processes.

Just in case someone else lands here I followed these instructions:

Just involved creating a Python Run/Debug and setting the 'Working Dir' to be the celery install location and set script to run as celery.


Please sign in to leave a comment.