Skip to content
Snippets Groups Projects
Unverified Commit 2eede1b9 authored by Mashiro's avatar Mashiro Committed by GitHub
Browse files

[Fix] Fix MessageHub sets resumed key twice (#839)

* Fix message hub

* Remove _set_resumed_keys in update_scalars and update_info_dict

* remove  in update_scalars

* clean unnecessary code
parent b44048ae
No related branches found
No related tags found
No related merge requests found
......@@ -173,19 +173,18 @@ class MessageHub(ManagerMixin):
assert isinstance(log_dict, dict), ('`log_dict` must be a dict!, '
f'but got {type(log_dict)}')
for log_name, log_val in log_dict.items():
self._set_resumed_keys(log_name, resumed)
if isinstance(log_val, dict):
assert 'value' in log_val, \
f'value must be defined in {log_val}'
count = self._get_valid_value(log_val.get('count', 1))
checked_value = self._get_valid_value(log_val['value'])
value = log_val['value']
else:
count = 1
checked_value = self._get_valid_value(log_val)
value = log_val
assert isinstance(count,
int), ('The type of count must be int. but got '
f'{type(count): {count}}')
self.update_scalar(log_name, checked_value, count)
self.update_scalar(log_name, value, count, resumed)
def update_info(self, key: str, value: Any, resumed: bool = True) -> None:
"""Update runtime information.
......@@ -208,7 +207,6 @@ class MessageHub(ManagerMixin):
could be resumed.
"""
self._set_resumed_keys(key, resumed)
self._resumed_keys[key] = resumed
self._runtime_info[key] = value
def update_info_dict(self, info_dict: dict, resumed: bool = True) -> None:
......@@ -233,7 +231,6 @@ class MessageHub(ManagerMixin):
assert isinstance(info_dict, dict), ('`log_dict` must be a dict!, '
f'but got {type(info_dict)}')
for key, value in info_dict.items():
self._set_resumed_keys(key, resumed)
self.update_info(key, value, resumed=resumed)
def _set_resumed_keys(self, key: str, resumed: bool) -> None:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment