Skip to content

Commit

Permalink
Handle new service info table
Browse files Browse the repository at this point in the history
  • Loading branch information
fivegrant committed Sep 21, 2023
1 parent 89d3d19 commit 3e833da
Showing 1 changed file with 23 additions and 4 deletions.
27 changes: 23 additions & 4 deletions dashboard/ui/pages/1_TA1.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,23 @@ def format_timestamp_from_filename(filename):

report = report_files[timestamp_to_filename[selected_timestamp]]

if "scenarios" not in report: # OLD FORMAT
report_scenarios = report
services = None
else: # NEW FORMAT
report_scenarios = report["scenarios"]
services = report["services"]


test_results = defaultdict(lambda: defaultdict())

for scenario, content in report.items():
for scenario, content in report_scenarios.items():
for operation, tests in content["operations"].items():
for name, result in tests.items():
test_results[name][(content["name"], operation)] = result

scenarios = [report[scenario]["name"] for scenario in report.keys()]
operations = list(reduce(lambda left, right: left.union(right), [set(content["operations"].keys()) for content in report.values()], set()))
scenarios = [report_scenarios[scenario]["name"] for scenario in report_scenarios.keys()]
operations = list(reduce(lambda left, right: left.union(right), [set(content["operations"].keys()) for content in report_scenarios.values()], set()))
tests = sorted([i for i in test_results.keys() if i != "Logs"], reverse=True)
tests.append("Logs")

Expand Down Expand Up @@ -80,9 +88,20 @@ def format_timestamp_from_filename(filename):
Currently tests are run against SKEMA, MIT and Cosmos public instances.
"""

if services is not None:
st.write("### Service Info")
service_names = list(services.keys())
service_data = {
"Service": service_names,
"Source": [services[name]["source"] for name in service_names],
"Version": [services[name]["version"] for name in service_names],
}
st.dataframe(pd.DataFrame(service_data), hide_index=True)


st.write("### Scenario Overview")
scenarios_overview = ""
for kk, vv in sorted(report.items(), key=lambda item: item[1]['name']):
for kk, vv in sorted(report_scenarios.items(), key=lambda item: item[1]['name']):
scenarios_overview += f"- **{vv['name']}**: {vv['description']}\n"
st.write(scenarios_overview)

Expand Down

0 comments on commit 3e833da

Please sign in to comment.