From 79ef74a426669eff9a901077901cb2f2ad114fa5 Mon Sep 17 00:00:00 2001 From: Tibor Frank Date: Wed, 15 Nov 2023 13:22:33 +0000 Subject: [PATCH] C-Dash: Add detailed info to iterative graphs Change-Id: I8cd51452049690f7180fab6020843eb3395fcd74 Signed-off-by: Tibor Frank --- csit.infra.dash/app/cdash/report/graphs.py | 40 ++++++++++++++++++++++-------- csit.infra.dash/app/cdash/report/layout.py | 39 +++++++++++++++++------------ 2 files changed, 52 insertions(+), 27 deletions(-) diff --git a/csit.infra.dash/app/cdash/report/graphs.py b/csit.infra.dash/app/cdash/report/graphs.py index 6b7fd12850..d1cd1427a1 100644 --- a/csit.infra.dash/app/cdash/report/graphs.py +++ b/csit.infra.dash/app/cdash/report/graphs.py @@ -14,6 +14,7 @@ """Implementation of graphs for iterative data. """ + import plotly.graph_objects as go import pandas as pd @@ -129,17 +130,28 @@ def graph_iterative(data: pd.DataFrame, sel:dict, layout: dict, nr_of_samples = len(y_data) + customdata = list() + metadata = { + "csit release": itm["rls"], + "dut": itm["dut"], + "dut version": itm["dutver"], + "infra": itm["phy"], + "test": ( + f"{itm['area']}-{itm['framesize']}-{itm['core']}-" + f"{itm['test']}-{itm['testtype']}" + ) + } + if itm["testtype"] == "mrr": - c_data = [ - ( - f"{itm_data['job'].to_list()[0]}/", - f"{itm_data['build'].to_list()[0]}" - ), - ] * nr_of_samples + metadata["csit-ref"] = ( + f"{itm_data['job'].to_list()[0]}/", + f"{itm_data['build'].to_list()[0]}" + ) + customdata = [{"metadata": metadata}, ] * nr_of_samples else: - c_data = list() for _, row in itm_data.iterrows(): - c_data.append(f"{row['job']}/{row['build']}") + metadata["csit-ref"] = f"{row['job']}/{row['build']}" + customdata.append({"metadata": deepcopy(metadata)}) tput_kwargs = dict( y=y_data, name=( @@ -152,7 +164,7 @@ def graph_iterative(data: pd.DataFrame, sel:dict, layout: dict, boxpoints="all", jitter=0.3, marker=dict(color=get_color(idx)), - customdata=c_data + customdata=customdata ) tput_traces.append(go.Box(**tput_kwargs)) show_tput = True @@ -160,9 +172,15 @@ def graph_iterative(data: pd.DataFrame, sel:dict, layout: dict, if ttype == "pdr": customdata = list() for _, row in itm_data.iterrows(): - customdata.append( - get_hdrh_latencies(row, f"{row['job']}/{row['build']}") + hdrh = get_hdrh_latencies( + row, + f"{metadata['infra']}-{metadata['test']}" ) + metadata["csit-ref"] = f"{row['job']}/{row['build']}" + customdata.append({ + "metadata": deepcopy(metadata), + "hdrh": hdrh + }) y_lat_row = itm_data[C.VALUE_ITER["latency"]].to_list() y_lat = [(y / norm_factor) for y in y_lat_row] diff --git a/csit.infra.dash/app/cdash/report/layout.py b/csit.infra.dash/app/cdash/report/layout.py index 765af4e1e6..81cc913903 100644 --- a/csit.infra.dash/app/cdash/report/layout.py +++ b/csit.infra.dash/app/cdash/report/layout.py @@ -14,6 +14,7 @@ """Plotly Dash HTML layout override. """ + import logging import pandas as pd import dash_bootstrap_components as dbc @@ -1389,32 +1390,43 @@ class Layout: "q1", "lower fence", "min", "outlier") elif len(data) == 1: if param == "lat": - stats = ("Average Latency at 50% PDR", ) + stats = ("average latency at 50% PDR", ) else: - stats = ("Throughput", ) + stats = ("throughput", ) else: return list() unit = " [us]" if param == "lat" else str() return [(f"{stat}{unit}", f"{value['y']:,.0f}") for stat, value in zip(stats, data)] + customdata = graph_data[0].get("customdata", dict()) + datapoint = customdata.get("metadata", dict()) + hdrh_data = customdata.get("hdrh", dict()) + + list_group_items = list() + for k, v in datapoint.items(): + if k == "csit-ref": + if len(graph_data) > 1: + continue + list_group_item = dbc.ListGroupItem([ + dbc.Badge(k), + html.A(v, href=f"{C.URL_JENKINS}{v}", target="_blank") + ]) + else: + list_group_item = dbc.ListGroupItem([dbc.Badge(k), v]) + list_group_items.append(list_group_item) + graph = list() if trigger.idx == "tput": title = "Throughput" elif trigger.idx == "lat": title = "Latency" if len(graph_data) == 1: - hdrh_data = graph_data[0].get("customdata", None) if hdrh_data: - name = hdrh_data.pop("name") graph = [dbc.Card( class_name="gy-2 p-0", children=[ - dbc.CardHeader(html.A( - name, - href=f"{C.URL_JENKINS}{name}", - target="_blank" - )), + dbc.CardHeader(hdrh_data.pop("name")), dbc.CardBody(dcc.Graph( id="hdrh-latency-graph", figure=graph_hdrh_latency( @@ -1425,15 +1437,10 @@ class Layout: ] else: raise PreventUpdate - list_group_items = list() + for k, v in _process_stats(graph_data, trigger.idx): list_group_items.append(dbc.ListGroupItem([dbc.Badge(k), v])) - if trigger.idx == "tput" and len(list_group_items) == 1: - job = graph_data[0].get("customdata", "") - list_group_items.append(dbc.ListGroupItem([ - dbc.Badge("csit-ref"), - html.A(job, href=f"{C.URL_JENKINS}{job}", target="_blank") - ])) + metadata = [ dbc.Card( class_name="gy-2 p-0", -- 2.16.6