PyCharm (Intellij with Python Plugin) - Running two different processes in same docker-compose container

Answered

I'm developing a python app, and I'm trying to use a docker-compose environment as the remote interpreter. The multiple processes are normally managed by supervisord.

It's all been working well, until the point where I want to run some of the processes separately - for example to debug one whilst others are also running in the background.

However, if I start run configuration A, and then subsequently run configuration B (for a debug session), the first session is killed as the docker-compose up for the second begins.

I know you can use the "Allow parallel run" check box to run the same configuration twice in the same container - but how do you do this with a second run configuration?

Thanks for the help

 

 

1
2 comments

Hi,

There is no dedicated feature in PyCharm for that, but you could use exec to re-use existing container.

So you can start some test1.py script with default run configuration and then start test2.py script with exec in Command and options.

In such a case test1.py execution won't be terminated.

1
Avatar
Permanently deleted user

Thanks! - managed to get it working similarly with run. It does spin up another instance, but does work for my use case (using shared volumes, etc)

The exec unfortunately doesn't work, I get a winpty error. Guess I could alias the docker-compose command, will give that a go

Thank you

0

Please sign in to leave a comment.