ogul
ogul

Reputation: 137

How to configure pycharm debug for docker-compose celery command?

I successfully configure my remote interpreter with docker-compose at Pycharm and can successfully run my server in debug mode to put breakpoints and debug the problems. Unfortunately I can't do the same thing for the docker-compose run for celery workers. When I run this command in my project folder it is working no problem but how can I run this in Pycharm debug mode ?

docker-compose run --rm app celery worker -A workers.build_events -Q build_events -l DEBUG

Upvotes: 11

Views: 3723

Answers (1)

asdag8
asdag8

Reputation: 198

I was just able to get this working with a Python run configuration.

Make sure the working directory is set to the directory that your application code is located at inside your image.

Make sure that the script path is the path to the Celery executable. In my case, I have a virtualenv inside my application folder, so I just used a relative path from my working directory.

Make sure that your interpreter is set to a properly configured docker compose interpreter.

Finally, I've added -P solo to force Celery into a single-threaded mode. This is not required, but for me it makes breakpoints and debugging much easier.

Example run configuration: Celery run configuration

Upvotes: 7

Related Questions