Skip to content

Commit

Permalink
fix(analyze_topic): treat no yaml file case
Browse files Browse the repository at this point in the history
Signed-off-by: takeshi.iwanari <[email protected]>
  • Loading branch information
iwatake2222 committed Sep 17, 2024
1 parent f855471 commit a9899d3
Showing 1 changed file with 14 additions and 11 deletions.
25 changes: 14 additions & 11 deletions report/analyze_topic/make_report_analyze_topic.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,17 +67,20 @@ def make_pages_for_component(path_component: Path, report_name: str, node_html_d
topic_html_list = [topic_path.name + '.html' for topic_path in topic_path_list]
topic_name_list = []
for i, topic_path in enumerate(topic_path_list):
with open(topic_path.joinpath('stats_FREQUENCY.yaml'), 'r', encoding='utf-8') as f_yaml_freq, \
open(topic_path.joinpath('stats_PERIOD.yaml'), 'r', encoding='utf-8') as f_yaml_period, \
open(topic_path.joinpath('stats_LATENCY.yaml'), 'r', encoding='utf-8') as f_yaml_latency:
stats_freq = yaml.safe_load(f_yaml_freq)
stats_period = yaml.safe_load(f_yaml_period)
stats_latency = yaml.safe_load(f_yaml_latency)
if len(stats_freq) == 0:
continue
topic_name = stats_freq[0]['topic_name']
topic_name_list.append(topic_name)
render_detail_page(path_component.joinpath(topic_html_list[i]), topic_path.name, f'Topic: {topic_name}', report_name, stats_freq, stats_period, stats_latency, node_html_dict)
try:
with open(topic_path.joinpath('stats_FREQUENCY.yaml'), 'r', encoding='utf-8') as f_yaml_freq, \
open(topic_path.joinpath('stats_PERIOD.yaml'), 'r', encoding='utf-8') as f_yaml_period, \
open(topic_path.joinpath('stats_LATENCY.yaml'), 'r', encoding='utf-8') as f_yaml_latency:
stats_freq = yaml.safe_load(f_yaml_freq)
stats_period = yaml.safe_load(f_yaml_period)
stats_latency = yaml.safe_load(f_yaml_latency)
if len(stats_freq) == 0:
continue
topic_name = stats_freq[0]['topic_name']
topic_name_list.append(topic_name)
render_detail_page(path_component.joinpath(topic_html_list[i]), topic_path.name, f'Topic: {topic_name}', report_name, stats_freq, stats_period, stats_latency, node_html_dict)
except:
continue

render_index_page(path_component.joinpath('index.html'), f'Topic: {path_component.name}', report_name, topic_name_list, topic_html_list)

Expand Down

0 comments on commit a9899d3

Please sign in to comment.