From 13617c1ddb6fb2324e331d14ffa38635a13a10b1 Mon Sep 17 00:00:00 2001 From: Tibor Frank Date: Tue, 16 Aug 2022 15:04:35 +0200 Subject: UTI: Set params in ctrl panel from url - Performance trending - Iterative data Change-Id: Ifcd8e805dcbd12ef0cb739b11b0f52269acd1804 Signed-off-by: Tibor Frank --- resources/tools/dash/app/pal/trending/layout.py | 112 ++++++++++++++-------- resources/tools/dash/app/pal/trending/layout.yaml | 29 +----- 2 files changed, 73 insertions(+), 68 deletions(-) (limited to 'resources/tools/dash/app/pal/trending') diff --git a/resources/tools/dash/app/pal/trending/layout.py b/resources/tools/dash/app/pal/trending/layout.py index 2be19f8439..187860dffb 100644 --- a/resources/tools/dash/app/pal/trending/layout.py +++ b/resources/tools/dash/app/pal/trending/layout.py @@ -32,7 +32,7 @@ from ast import literal_eval from ..utils.constants import Constants as C from ..utils.utils import show_tooltip, label, sync_checklists, list_tests, \ - get_date, gen_new_url + get_date, gen_new_url, generate_options from ..utils.url_processing import url_decode from ..data.data import Data from .graphs import graph_trending, graph_hdrh_latency, \ @@ -952,12 +952,17 @@ class Layout: """ ctrl_panel = self.ControlPanel(cp_data) + norm = cl_normalize d_start = get_date(d_start) d_end = get_date(d_end) # Parse the url: parsed_url = url_decode(href) + if parsed_url: + url_params = parsed_url["params"] + else: + url_params = None row_fig_tput = no_update row_fig_lat = no_update @@ -969,11 +974,8 @@ class Layout: if trigger_id == "dd-ctrl-dut": try: - dut = self.spec_tbs[dd_dut] - options = sorted( - [{"label": v, "value": v}for v in dut.keys()], - key=lambda d: d["label"] - ) + options = \ + generate_options(sorted(self.spec_tbs[dd_dut].keys())) disabled = False except KeyError: options = list() @@ -1006,10 +1008,8 @@ class Layout: try: dut = ctrl_panel.get("dd-ctrl-dut-value") phy = self.spec_tbs[dut][dd_phy] - options = sorted( - [{"label": label(v), "value": v} for v in phy.keys()], - key=lambda d: d["label"] - ) + options = [{"label": label(v), "value": v} \ + for v in sorted(phy.keys())] disabled = False except KeyError: options = list() @@ -1040,10 +1040,7 @@ class Layout: dut = ctrl_panel.get("dd-ctrl-dut-value") phy = ctrl_panel.get("dd-ctrl-phy-value") area = self.spec_tbs[dut][phy][dd_area] - options = sorted( - [{"label": v, "value": v} for v in area.keys()], - key=lambda d: d["label"] - ) + options = generate_options(sorted(area.keys())) disabled = False except KeyError: options = list() @@ -1067,34 +1064,25 @@ class Layout: "cl-ctrl-testtype-all-options": C.CL_ALL_DISABLED, }) elif trigger_id == "dd-ctrl-test": - core_opts = list() - framesize_opts = list() - testtype_opts = list() dut = ctrl_panel.get("dd-ctrl-dut-value") phy = ctrl_panel.get("dd-ctrl-phy-value") area = ctrl_panel.get("dd-ctrl-area-value") - test = self.spec_tbs[dut][phy][area][dd_test] - cores = test["core"] - fsizes = test["frame-size"] - ttypes = test["test-type"] - if dut and phy and area and dd_test: - core_opts = [{"label": v, "value": v} - for v in sorted(cores)] - framesize_opts = [{"label": v, "value": v} - for v in sorted(fsizes)] - testtype_opts = [{"label": v, "value": v} - for v in sorted(ttypes)] + if all((dut, phy, area, dd_test, )): + test = self.spec_tbs[dut][phy][area][dd_test] ctrl_panel.set({ "dd-ctrl-test-value": dd_test, - "cl-ctrl-core-options": core_opts, + "cl-ctrl-core-options": \ + generate_options(sorted(test["core"])), "cl-ctrl-core-value": list(), "cl-ctrl-core-all-value": list(), "cl-ctrl-core-all-options": C.CL_ALL_ENABLED, - "cl-ctrl-framesize-options": framesize_opts, + "cl-ctrl-framesize-options": \ + generate_options(sorted(test["frame-size"])), "cl-ctrl-framesize-value": list(), "cl-ctrl-framesize-all-value": list(), "cl-ctrl-framesize-all-options": C.CL_ALL_ENABLED, - "cl-ctrl-testtype-options": testtype_opts, + "cl-ctrl-testtype-options": \ + generate_options(sorted(test["test-type"])), "cl-ctrl-testtype-value": list(), "cl-ctrl-testtype-all-value": list(), "cl-ctrl-testtype-all-options": C.CL_ALL_ENABLED, @@ -1222,16 +1210,59 @@ class Layout: new_store_sel.append(item) store_sel = new_store_sel elif trigger_id == "url": - # TODO: Add verification - url_params = parsed_url["params"] if url_params: - store_sel = literal_eval( - url_params.get("store_sel", list())[0]) - d_start = get_date(url_params.get("start", list())[0]) - d_end = get_date(url_params.get("end", list())[0]) + try: + store_sel = literal_eval(url_params["store_sel"][0]) + d_start = get_date(url_params["start"][0]) + d_end = get_date(url_params["end"][0]) + norm = literal_eval(url_params["norm"][0]) + except (KeyError, IndexError): + pass if store_sel: row_card_sel_tests = C.STYLE_ENABLED row_btns_sel_tests = C.STYLE_ENABLED + last_test = store_sel[-1] + test = self.spec_tbs[last_test["dut"]]\ + [last_test["phy"]][last_test["area"]]\ + [last_test["test"]] + ctrl_panel.set({ + "dd-ctrl-dut-value": last_test["dut"], + "dd-ctrl-phy-value": last_test["phy"], + "dd-ctrl-phy-options": generate_options(sorted( + self.spec_tbs[last_test["dut"]].keys())), + "dd-ctrl-phy-disabled": False, + "dd-ctrl-area-value": last_test["area"], + "dd-ctrl-area-options": [ + {"label": label(v), "value": v} \ + for v in sorted( + self.spec_tbs[last_test["dut"]]\ + [last_test["phy"]].keys()) + ], + "dd-ctrl-area-disabled": False, + "dd-ctrl-test-value": last_test["test"], + "dd-ctrl-test-options": generate_options(sorted( + self.spec_tbs[last_test["dut"]]\ + [last_test["phy"]]\ + [last_test["area"]].keys())), + "dd-ctrl-test-disabled": False, + "cl-ctrl-core-options": generate_options(sorted( + test["core"])), + "cl-ctrl-core-value": [last_test["core"].upper(), ], + "cl-ctrl-core-all-value": list(), + "cl-ctrl-core-all-options": C.CL_ALL_ENABLED, + "cl-ctrl-framesize-options": generate_options( + sorted(test["frame-size"])), + "cl-ctrl-framesize-value": \ + [last_test["framesize"].upper(), ], + "cl-ctrl-framesize-all-value": list(), + "cl-ctrl-framesize-all-options": C.CL_ALL_ENABLED, + "cl-ctrl-testtype-options": generate_options(sorted( + test["test-type"])), + "cl-ctrl-testtype-value": \ + [last_test["testtype"].upper(), ], + "cl-ctrl-testtype-all-value": list(), + "cl-ctrl-testtype-all-options": C.CL_ALL_ENABLED + }) if trigger_id in ("btn-ctrl-add", "url", "dpr-period", "btn-sel-remove", "cl-ctrl-normalize"): @@ -1239,13 +1270,14 @@ class Layout: row_fig_tput, row_fig_lat, row_btn_dwnld = \ _generate_plotting_area( graph_trending(self.data, store_sel, self.layout, - d_start, d_end, bool(cl_normalize)), + d_start, d_end, bool(norm)), gen_new_url( parsed_url, { "store_sel": store_sel, "start": d_start, - "end": d_end + "end": d_end, + "norm": norm } ) ) @@ -1269,7 +1301,7 @@ class Layout: disabled = True ctrl_panel.set({ "btn-ctrl-add-disabled": disabled, - "cl-normalize-value": cl_normalize + "cl-normalize-value": norm }) ret_val = [ diff --git a/resources/tools/dash/app/pal/trending/layout.yaml b/resources/tools/dash/app/pal/trending/layout.yaml index 0c0b62d591..9c35d93667 100644 --- a/resources/tools/dash/app/pal/trending/layout.yaml +++ b/resources/tools/dash/app/pal/trending/layout.yaml @@ -1,15 +1,10 @@ plot-trending-tput: - # title: "" - # titlefont: - # size: 16 autosize: True showlegend: True - # width: 1100 - #height: 400 yaxis: showticklabels: True tickformat: ".3s" - title: "Throughput [Mpps]" + title: "Throughput [pps]" hoverformat: ".5s" gridcolor: "rgb(238, 238, 238)" linecolor: "rgb(238, 238, 238)" @@ -77,13 +72,8 @@ plot-trending-tput: namelength: -1 plot-trending-lat: - # title: "" - # titlefont: - # size: 16 autosize: True showlegend: True - # width: 1100 - #height: 400 yaxis: showticklabels: True tickformat: ".3s" @@ -155,18 +145,10 @@ plot-trending-lat: namelength: -1 plot-hdrh-latency: - # title: - # text: "Latency by Percentile Distribution" - # xanchor: "center" - # x: 0.5 - # font: - # size: 10 showlegend: True legend: traceorder: "normal" orientation: "h" - # font: - # size: 16 xanchor: "left" yanchor: "top" x: 0 @@ -176,8 +158,6 @@ plot-hdrh-latency: xaxis: type: "log" title: "Percentile [%]" - # titlefont: - # size: 14 autorange: False fixedrange: True gridcolor: "rgb(230, 230, 230)" @@ -189,12 +169,8 @@ plot-hdrh-latency: tickcolor: "rgb(220, 220, 220)" tickvals: [1, 2, 1e1, 20, 1e2, 1e3, 1e4, 1e5, 1e6] ticktext: [0, 50, 90, 95, 99, 99.9, 99.99, 99.999, 99.9999] - # tickfont: - # size: 14 yaxis: title: "One-Way Latency per Direction [us]" - # titlefont: - # size: 14 gridcolor: "rgb(230, 230, 230)" linecolor: "rgb(220, 220, 220)" linewidth: 1 @@ -202,9 +178,6 @@ plot-hdrh-latency: showline: True showticklabels: True tickcolor: "rgb(220, 220, 220)" - # tickfont: - # size: 14 autosize: True - #height: 400 paper_bgcolor: "white" plot_bgcolor: "white" -- cgit 1.2.3-korg