提交 51024d3b 编写于 作者: M mindspore-ci-bot 提交者: Gitee

!451 use forkserver multiprocess context to avoid forking child process with...

!451 use forkserver multiprocess context to avoid forking child process with locked stream resource(eg stdout)
Merge pull request !451 from wenkai/wk5_fix_log_stream_flush_stuck
......@@ -16,6 +16,7 @@
import fractions
import math
import threading
import multiprocessing
from concurrent import futures
from mindinsight.utils.log import utils_logger as logger
......@@ -23,6 +24,9 @@ from mindinsight.utils.constant import GeneralErrors
from mindinsight.utils.exceptions import MindInsightException
_MP_CONTEXT = multiprocessing.get_context(method="forkserver")
class ComputingResourceManager:
"""
Manager for computing resources.
......@@ -44,7 +48,7 @@ class ComputingResourceManager:
for ind in range(self._executors_cnt)
}
self._remaining_executors = len(self._executors)
self._backend = futures.ProcessPoolExecutor(max_workers=max_processes_cnt)
self._backend = futures.ProcessPoolExecutor(max_workers=max_processes_cnt, mp_context=_MP_CONTEXT)
logger.info("Initialized ComputingResourceManager with executors_cnt=%s, max_processes_cnt=%s.",
executors_cnt, max_processes_cnt)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册