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 manage.py 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
3 comments
Comment actions Permalink
hmm, I think I've had this work before; generally things you can set up as a Python run configuration (which includes manage.py 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.
1
Comment actions Permalink
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.
0
Comment actions Permalink

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

http://stackoverflow.com/questions/29312809/how-do-i-enable-remote-celery-debugging-in-pycharm

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.

0

Please sign in to leave a comment.