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

!2152 Fix two issues of having too many processes and no attribute of '_closed'

Merge pull request !2152 from 李鸿章/fix_issues
...@@ -47,7 +47,7 @@ class EventWriter(Process): ...@@ -47,7 +47,7 @@ class EventWriter(Process):
def run(self): def run(self):
with Pool() as pool: with Pool(min(cpu_count(), 32)) as pool:
deq = deque() deq = deque()
while True: while True:
while deq and deq[0].ready(): while deq and deq[0].ready():
......
...@@ -89,6 +89,8 @@ class SummaryRecord: ...@@ -89,6 +89,8 @@ class SummaryRecord:
file_suffix="_MS", file_suffix="_MS",
network=None): network=None):
self._event_writer, self._closed = None, False
_check_str_by_regular(file_prefix) _check_str_by_regular(file_prefix)
_check_str_by_regular(file_suffix) _check_str_by_regular(file_suffix)
self.log_path = _make_directory(log_dir) self.log_path = _make_directory(log_dir)
...@@ -113,7 +115,6 @@ class SummaryRecord: ...@@ -113,7 +115,6 @@ class SummaryRecord:
self.suffix = file_suffix self.suffix = file_suffix
self.network = network self.network = network
self.has_graph = False self.has_graph = False
self._closed = False
# create the summary writer file # create the summary writer file
self.event_file_name = get_event_file_name(self.prefix, self.suffix) self.event_file_name = get_event_file_name(self.prefix, self.suffix)
...@@ -122,8 +123,6 @@ class SummaryRecord: ...@@ -122,8 +123,6 @@ class SummaryRecord:
except Exception as ex: except Exception as ex:
raise RuntimeError(ex) raise RuntimeError(ex)
self._event_writer = None
def _init_event_writer(self): def _init_event_writer(self):
"""Init event writer and write metadata.""" """Init event writer and write metadata."""
event_writer = EventWriter(self.full_file_name, self.flush_time) event_writer = EventWriter(self.full_file_name, self.flush_time)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册