How can I debug a python code that contains Multiprocesses and Multi threads?

450 Views Asked by At

I am writing a python code that contains the use of ThreadPoolExecutor and ProcessPoolExecutor. I would like to debug the code, specially the functions that are being called in parallel. Being able to stop execution, set breakpoints, inspect variables etc

How can this be made? I tried but since the processes are being in other threads, breakpoints do not work.

1

There are 1 best solutions below

2
Yilun Zhao On

After struggling to search a solution using native debuggers like pdb. I finnally find that maybe using vscode with python extension is the best solution, it can automatically step into subprocess/threads.