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

!88 Fix: Samples from previous steps are erased due to tags size too large

Merge pull request !88 from 李鸿章/fix_step_erased
......@@ -29,7 +29,7 @@ TensorEvent = collections.namedtuple(
# config for `EventsData`
_DEFAULT_STEP_SIZES_PER_TAG = settings.DEFAULT_STEP_SIZES_PER_TAG
_MAX_DELETED_TAGS_SIZE = settings.MAX_TAG_SIZE_PER_EVENTS_DATA * 100
CONFIG = {
'max_total_tag_sizes': settings.MAX_TAG_SIZE_PER_EVENTS_DATA,
'max_tag_sizes_per_plugin':
......@@ -60,6 +60,7 @@ class EventsData:
self._max_step_sizes_per_tag = self._config['max_step_sizes_per_tag']
self._tags = list()
self._deleted_tags = set()
self._reservoir_by_tag = {}
self._reservoir_mutex_lock = threading.Lock()
......@@ -82,6 +83,8 @@ class EventsData:
if tag not in set(self._tags):
deleted_tag = self._check_tag_out_of_spec(plugin_name)
if deleted_tag is not None:
if tag in self._deleted_tags:
return
self.delete_tensor_event(deleted_tag)
self._tags.append(tag)
......@@ -114,6 +117,8 @@ class EventsData:
Args:
tag (str): The tag name.
"""
if len(self._deleted_tags) < _MAX_DELETED_TAGS_SIZE:
self._deleted_tags.add(tag)
self._tags.remove(tag)
for plugin_name, lock in self._tags_by_plugin_mutex_lock.items():
with lock:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册