DEFAULT_JOB = "csit-vpp-perf-mrr-daily-master-2n-icx"
- def __init__(self, app: Flask, html_layout_file: str, spec_file: str,
+ URL_STYLE = {
+ "background-color": "#d2ebf5",
+ "border-color": "#bce1f1",
+ "color": "#135d7c"
+ }
+
+ def __init__(self, app: Flask, html_layout_file: str,
graph_layout_file: str, data_spec_file: str, tooltip_file: str,
time_period: int=None) -> None:
"""
# Inputs
self._app = app
self._html_layout_file = html_layout_file
- self._spec_file = spec_file
self._graph_layout_file = graph_layout_file
self._data_spec_file = data_spec_file
self._tooltip_file = tooltip_file
"dut_version": list(),
"hosts": list(),
"passed": list(),
- "failed": list()
+ "failed": list(),
+ "lst_failed": list()
}
for job in jobs:
- # TODO: Add list of failed tests for each build
df_job = df_tst_info.loc[(df_tst_info["job"] == job)]
builds = df_job["build"].unique()
for build in builds:
tst_info["dut_version"].append(df_build["dut_version"].iloc[-1])
tst_info["hosts"].append(df_build["hosts"].iloc[-1])
try:
- passed = df_build.value_counts(subset='passed')[True]
+ passed = df_build.value_counts(subset="passed")[True]
except KeyError:
passed = 0
try:
- failed = df_build.value_counts(subset='passed')[False]
+ failed = df_build.value_counts(subset="passed")[False]
+ failed_tests = df_build.loc[(df_build["passed"] == False)]\
+ ["test_id"].to_list()
+ l_failed = list()
+ for tst in failed_tests:
+ lst_tst = tst.split(".")
+ suite = lst_tst[-2].replace("2n1l-", "").\
+ replace("1n1l-", "").replace("2n-", "")
+ l_failed.append(f"{suite.split('-')[0]}-{lst_tst[-1]}")
except KeyError:
failed = 0
+ l_failed = list()
tst_info["passed"].append(passed)
tst_info["failed"].append(failed)
+ tst_info["lst_failed"].append(sorted(l_failed))
self._data = data_stats.merge(pd.DataFrame.from_dict(tst_info))
lst_job[1], lst_job[3], lst_job[4]))
}
- def _show_tooltip(self, id: str, title: str) -> list:
+ def _show_tooltip(self, id: str, title: str,
+ clipboard_id: str=None) -> list:
"""
"""
return [
+ dcc.Clipboard(target_id=clipboard_id, title="Copy URL") \
+ if clipboard_id else str(),
f"{title} ",
dbc.Badge(
id=id,
),
dcc.Loading(
dbc.Offcanvas(
- class_name="w-25",
+ class_name="w-50",
id="offcanvas-metadata",
title="Detailed Information",
placement="end",
color="info"
),
dcc.Download(id="download-data")
- ]),
+ ])
]
),
dbc.Col( # Show URL
width=10,
children=[
- dbc.Card(
- id="card-url",
- body=True,
- class_name="gy-2 p-0",
- children=[]
- ),
+ dbc.InputGroup(
+ class_name="me-1",
+ children=[
+ dbc.InputGroupText(
+ style=self.URL_STYLE,
+ children=self._show_tooltip(
+ "help-url", "URL", "input-url")
+ ),
+ dbc.Input(
+ id="input-url",
+ readonly=True,
+ type="url",
+ style=self.URL_STYLE,
+ value=""
+ )
+ ]
+ )
]
)
]
Output("control-panel", "data"), # Store
Output("graph-passed", "figure"),
Output("graph-duration", "figure"),
- Output("card-url", "children"),
+ Output("input-url", "value"),
Output("ri-ttypes", "options"),
Output("ri-cadences", "options"),
Output("dd-tbeds", "options"),
ctrl_panel.panel,
fig_passed,
fig_duration,
- [ # URL
- dcc.Clipboard(
- target_id="card-url",
- title="Copy URL",
- style={"display": "inline-block"}
- ),
- new_url
- ]
+ new_url
]
ret_val.extend(ctrl_panel.values())
return ret_val
elif trigger_id == "graph-duration":
graph_data = duration_data["points"][0].get("text", "")
if graph_data:
+ lst_graph_data = graph_data.split("<br>")
+
+ # Prepare list of failed tests:
+ job = str()
+ build = str()
+ for itm in lst_graph_data:
+ if "csit-ref:" in itm:
+ job, build = itm.split(" ")[-1].split("/")
+ break
+ if job and build:
+ fail_tests = self.data.loc[
+ (self.data["job"] == job) &
+ (self.data["build"] == build)
+ ]["lst_failed"].values[0]
+ if not fail_tests:
+ fail_tests = None
+ else:
+ fail_tests = None
+
+ # Create the content of the offcanvas:
metadata = [
dbc.Card(
class_name="gy-2 p-0",
),
x.split(": ")[1]
]
- ) for x in graph_data.split("<br>")
+ ) for x in lst_graph_data
],
flush=True),
]
]
)
]
+
+ if fail_tests is not None:
+ metadata.append(
+ dbc.Card(
+ class_name="gy-2 p-0",
+ children=[
+ dbc.CardHeader(
+ f"List of Failed Tests ({len(fail_tests)})"
+ ),
+ dbc.CardBody(
+ id="failed-tests",
+ class_name="p-0",
+ children=[dbc.ListGroup(
+ children=[
+ dbc.ListGroupItem(x) \
+ for x in fail_tests
+ ],
+ flush=True),
+ ]
+ )
+ ]
+ )
+ )
+
open_canvas = True
return metadata, open_canvas