Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(track_path): organize track path table layout #164

Merged
merged 2 commits into from
Feb 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions report/common/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@


class ComponentManager:
def __new__(cls, *args, **kargs):

Check warning on line 175 in report/common/utils.py

View workflow job for this annotation

GitHub Actions / spell-check-differential

Unknown word (kargs)
if not hasattr(cls, "_instance"):
cls._instance = super(ComponentManager, cls).__new__(cls)
cls.component_dict = {} # pairs of component name and regular_exp
Expand Down Expand Up @@ -309,6 +309,8 @@
if os.path.exists(caret_record_info_path):
with open(caret_record_info_path, encoding='UTF-8') as f_yaml:
caret_record_info = yaml.safe_load(f_yaml)
if not caret_record_info:
caret_record_info = {}
note_text_top = '<ul>\n'
note_text_top += f'<li>trace_start_datetime: {trace_datetime}</li>\n'
new_caret_record_info = {}
Expand Down
1 change: 0 additions & 1 deletion report/report_analysis/template_html_analysis.html
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ <h2>Node Analysis Report</h2>
{% endfor %}
</ul>

<hr />
<hr />

<h2>Track of Response Time</h2>
Expand Down
4 changes: 3 additions & 1 deletion report/track_path/make_report_track_path.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
return f'{target_path_name.replace("/", "_")}.html'


def render_page(reportpath_version_dict, stats_path_dict, filename_path_dict, destination_path, template_path):

Check warning on line 56 in report/track_path/make_report_track_path.py

View workflow job for this annotation

GitHub Actions / spell-check-differential

Unknown word (reportpath)
"""Render html page"""
with app.app_context():
with open(template_path, 'r', encoding='utf-8') as f_html:
Expand All @@ -61,7 +61,7 @@
rendered = flask.render_template_string(
template_string,
title='Response Time Tracking',
reportpath_version_dict=reportpath_version_dict,

Check warning on line 64 in report/track_path/make_report_track_path.py

View workflow job for this annotation

GitHub Actions / spell-check-differential

Unknown word (reportpath)

Check warning on line 64 in report/track_path/make_report_track_path.py

View workflow job for this annotation

GitHub Actions / spell-check-differential

Unknown word (reportpath)
stats_path_dict=stats_path_dict,
filename_path_dict=filename_path_dict,
)
Expand Down Expand Up @@ -97,6 +97,8 @@
if os.path.exists(caret_record_info_path):
with open(caret_record_info_path, encoding='UTF-8') as f_yaml:
caret_record_info = yaml.safe_load(f_yaml)
if not caret_record_info:
caret_record_info = {}
autoware_version = caret_record_info.get('autoware_version', '')
pilot_auto_version = caret_record_info.get('pilot_auto_version', '')
env = caret_record_info.get('env', '')
Expand All @@ -113,7 +115,7 @@
elif autoware_version == '' and pilot_auto_version:
version = version + ', ' + pilot_auto_version
if job_description:
version = version + ', ' + job_description
version = version + ', ' + job_description[:20]
if env:
version = version + ', ' + env
if route:
Expand Down Expand Up @@ -169,7 +171,7 @@
"""Make stats"""
stats_file_dict = make_stats_file_dict(dest_dir, report_store_dir)

reportpath_version_dict = {} # key: version, value: path to report

Check warning on line 174 in report/track_path/make_report_track_path.py

View workflow job for this annotation

GitHub Actions / spell-check-differential

Unknown word (reportpath)
for version, stats_file in stats_file_dict.items():
path_report_file = Path(stats_file).parent.joinpath('index.html').resolve()
top_report_file = Path(stats_file).parent.parent.joinpath('index.html').resolve()
Expand All @@ -184,7 +186,7 @@
# Create a relpath from dest_dir
path_report_file = os.path.relpath(path_report_file, Path(dest_dir).resolve())
top_report_file = os.path.relpath(top_report_file, Path(dest_dir).resolve())
reportpath_version_dict[version] = (path_report_file, top_report_file)

Check warning on line 189 in report/track_path/make_report_track_path.py

View workflow job for this annotation

GitHub Actions / spell-check-differential

Unknown word (reportpath)

stats_version_dict = {} # key: version, value: stats
for version, stats_file in stats_file_dict.items():
Expand All @@ -194,8 +196,8 @@
target_path_name_list = []
if len(stats_version_dict)> 0:
current_version = next(reversed(stats_version_dict))
curent_stats = stats_version_dict[current_version]

Check warning on line 199 in report/track_path/make_report_track_path.py

View workflow job for this annotation

GitHub Actions / spell-check-differential

Unknown word (curent)
target_path_name_list = [target_path_info['target_path_name'] for target_path_info in curent_stats]

Check warning on line 200 in report/track_path/make_report_track_path.py

View workflow job for this annotation

GitHub Actions / spell-check-differential

Unknown word (curent)

# Create dataframe for each target path (index=version, column=avg, max, min, etc.)
df_per_path = pd.DataFrame(columns=pd.MultiIndex.from_product([target_path_name_list, value_name_list]), dtype=float)
Expand Down
4 changes: 2 additions & 2 deletions report/track_path/template_track_path.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,13 @@
{% set data_num = reportpath_version_dict.keys()|length %}
{% set table_heght = [(1 + data_num) * 3, 5* 3] | min %}
{% for target_path_name, stats in stats_path_dict.items() %}
<hr />
<h2 id="{{ target_path_name }}">{{ target_path_name }}</h2>
<iframe src="{{ filename_path_dict[target_path_name] }}" width="1200" height="420" scrolling="no"></iframe>
<div style="height: calc({{ table_heght }}em); overflow-y: scroll">
<table class="table table-hover table-bordered" style="word-break: break-word">
<thead>
<tr class="table-primary text-center">
<th>Version</th>
<th width="45%">Version</th>
<th>Link to report</th>
{% for value_name in stats.keys() | reverse %}
<th>{{ value_name}} [ms]</th>
Expand Down Expand Up @@ -57,6 +56,7 @@ <h2 id="{{ target_path_name }}">{{ target_path_name }}</h2>
</tbody>
</table>
</div>
<hr />
{% endfor %}
</div><!-- container -->

Expand Down
Loading