Visual Studio Code does not attach debugger to multi processes in python using pool map

Viewed 3631

Hi I am trying to debug multi processes in python. This below is a portion of where I run multi-processes using Pool

pool = Pool(num_half_logical_cpus)
pool_result_dict = pool.starmap(process_batches, lstListSets)

However, I can't hit any breakpoints. Can anyone guide me to hit those breakpoints I set up?

Thanks!

2 Answers

Add this option to launch.json will let you debug multiple processes.

"subProcess": true,

Then it will hit the breakpoint then you are able to select which process you want to step through (F10). There will be a list of processes at the lower-left sub-window.

Click on "Run and Debug" tab.

Then click "create a launch.json file."

enter image description here

Then click on "Python".

enter image description here

Then click on "Python File" configuration.

enter image description here

VSCode will create a "launch.json" file for you. At this point you will need to add "subProcess": true, as stated here https://stackoverflow.com/a/60529923/6121065

enter image description here

And you are good to go. Now you may debug your code. You may need to tweak the configurations where needed.

Related