How to debug when using multiprocessing in pycharm

I am debugging a multiprocessor program with anaconda2 in the pycharm community release. It has several background workflows. The workflow checks the input queue to retrieve the task without sleep before receiving the task. In fact, I am only interested in the main process. But the pycharm debugger always goes into the subprocess, it seems that the main process is not working, and the task is never sent. How can I make a debugger from a subprocess? The worker subprocess is as follows:

class ILSVRC_worker:

...

def run(self):
    cfg_parser = ConfigParser.ConfigParser()
    cfg_parser.read(self.cfg_path)
    data_factory = ILSVRC_DataFactory(cfg_parser)
    logger = mp.log_to_stderr(logging.INFO)
    while True:
        try:
            annotation_path = self.que_in.get(True,0.1)
        except Queue.Empty:
            continue
        if annotation_path is None:
            # to exit the subprocess
            logger.info('exit the worker process')
            break
        ...
+4
source share
1 answer

, , , , .

  • PID , , Tools > Attach to Process.. ( , ). , Pool, , .
  • - python.

-

+1

Source: https://habr.com/ru/post/1618219/


All Articles