diff options
-rw-r--r-- | resources/tools/dash/app/pal/report/layout.py | 127 | ||||
-rw-r--r-- | resources/tools/dash/app/pal/report/layout.yaml | 113 | ||||
-rw-r--r-- | resources/tools/dash/app/pal/trending/layout.py | 112 | ||||
-rw-r--r-- | resources/tools/dash/app/pal/trending/layout.yaml | 29 |
4 files changed, 161 insertions, 220 deletions
diff --git a/resources/tools/dash/app/pal/report/layout.py b/resources/tools/dash/app/pal/report/layout.py index 978ab0de6c..34ec6c16e1 100644 --- a/resources/tools/dash/app/pal/report/layout.py +++ b/resources/tools/dash/app/pal/report/layout.py @@ -30,7 +30,7 @@ from ast import literal_eval from ..utils.constants import Constants as C from ..utils.utils import show_tooltip, label, sync_checklists, list_tests, \ - gen_new_url + gen_new_url, generate_options from ..utils.url_processing import url_decode from ..data.data import Data from .graphs import graph_iterative, table_comparison, get_short_version, \ @@ -1001,9 +1001,14 @@ class Layout: """ ctrl_panel = self.ControlPanel(cp_data) + norm = cl_normalize # 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 @@ -1016,11 +1021,8 @@ class Layout: if trigger_id == "dd-ctrl-rls": try: - rls = self.spec_tbs[dd_rls] - options = sorted( - [{"label": v, "value": v} for v in rls.keys()], - key=lambda d: d["label"] - ) + options = \ + generate_options(sorted(self.spec_tbs[dd_rls].keys())) disabled = False except KeyError: options = list() @@ -1059,10 +1061,7 @@ class Layout: try: rls = ctrl_panel.get("dd-rls-value") dut = self.spec_tbs[rls][dd_dut] - options = sorted( - [{"label": v, "value": v} for v in dut.keys()], - key=lambda d: d["label"] - ) + options = generate_options(sorted(dut.keys())) disabled = False except KeyError: options = list() @@ -1099,10 +1098,7 @@ class Layout: rls = ctrl_panel.get("dd-rls-value") dut = ctrl_panel.get("dd-dut-value") dutver = self.spec_tbs[rls][dut][dd_dutver] - options = sorted( - [{"label": v, "value": v} for v in dutver.keys()], - key=lambda d: d["label"] - ) + options = generate_options(sorted(dutver.keys())) disabled = False except KeyError: options = list() @@ -1137,10 +1133,8 @@ class Layout: dut = ctrl_panel.get("dd-dut-value") dutver = ctrl_panel.get("dd-dutver-value") phy = self.spec_tbs[rls][dut][dutver][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() @@ -1173,10 +1167,7 @@ class Layout: dutver = ctrl_panel.get("dd-dutver-value") phy = ctrl_panel.get("dd-phy-value") area = self.spec_tbs[rls][dut][dutver][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() @@ -1205,22 +1196,22 @@ class Layout: dutver = ctrl_panel.get("dd-dutver-value") phy = ctrl_panel.get("dd-phy-value") area = ctrl_panel.get("dd-area-value") - test = self.spec_tbs[rls][dut][dutver][phy][area][dd_test] - if dut and phy and area and dd_test: + if all((rls, dut, dutver, phy, area, dd_test, )): + test = self.spec_tbs[rls][dut][dutver][phy][area][dd_test] ctrl_panel.set({ "dd-test-value": dd_test, - "cl-core-options": [{"label": v, "value": v} - for v in sorted(test["core"])], + "cl-core-options": \ + generate_options(sorted(test["core"])), "cl-core-value": list(), "cl-core-all-value": list(), "cl-core-all-options": C.CL_ALL_ENABLED, - "cl-framesize-options": [{"label": v, "value": v} - for v in sorted(test["frame-size"])], + "cl-framesize-options": \ + generate_options(sorted(test["frame-size"])), "cl-framesize-value": list(), "cl-framesize-all-value": list(), "cl-framesize-all-options": C.CL_ALL_ENABLED, - "cl-testtype-options": [{"label": v, "value": v} - for v in sorted(test["test-type"])], + "cl-testtype-options": \ + generate_options(sorted(test["test-type"])), "cl-testtype-value": list(), "cl-testtype-all-value": list(), "cl-testtype-all-options": C.CL_ALL_ENABLED, @@ -1356,14 +1347,70 @@ 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]) + try: + store_sel = literal_eval(url_params["store_sel"][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["rls"]]\ + [last_test["dut"]][last_test["dutver"]]\ + [last_test["phy"]][last_test["area"]]\ + [last_test["test"]] + ctrl_panel.set({ + "dd-rls-value": last_test["rls"], + "dd-dut-value": last_test["dut"], + "dd-dut-options": generate_options(sorted( + self.spec_tbs[last_test["rls"]].keys())), + "dd-dut-disabled": False, + "dd-dutver-value": last_test["dutver"], + "dd-dutver-options": generate_options(sorted( + self.spec_tbs[last_test["rls"]]\ + [last_test["dut"]].keys())), + "dd-dutver-disabled": False, + "dd-phy-value": last_test["phy"], + "dd-phy-options": generate_options(sorted( + self.spec_tbs[last_test["rls"]]\ + [last_test["dut"]]\ + [last_test["dutver"]].keys())), + "dd-phy-disabled": False, + "dd-area-value": last_test["area"], + "dd-area-options": [ + {"label": label(v), "value": v} for v in \ + sorted(self.spec_tbs[last_test["rls"]]\ + [last_test["dut"]][last_test["dutver"]]\ + [last_test["phy"]].keys()) + ], + "dd-area-disabled": False, + "dd-test-value": last_test["test"], + "dd-test-options": generate_options(sorted( + self.spec_tbs[last_test["rls"]]\ + [last_test["dut"]][last_test["dutver"]]\ + [last_test["phy"]]\ + [last_test["area"]].keys())), + "dd-test-disabled": False, + "cl-core-options": generate_options(sorted( + test["core"])), + "cl-core-value": [last_test["core"].upper(), ], + "cl-core-all-value": list(), + "cl-core-all-options": C.CL_ALL_ENABLED, + "cl-framesize-options": generate_options( + sorted(test["frame-size"])), + "cl-framesize-value": \ + [last_test["framesize"].upper(), ], + "cl-framesize-all-value": list(), + "cl-framesize-all-options": C.CL_ALL_ENABLED, + "cl-testtype-options": generate_options(sorted( + test["test-type"])), + "cl-testtype-value": \ + [last_test["testtype"].upper(), ], + "cl-testtype-all-value": list(), + "cl-testtype-all-options": C.CL_ALL_ENABLED + }) if trigger_id in ("btn-ctrl-add", "url", "btn-sel-remove", "cl-ctrl-normalize"): @@ -1371,13 +1418,15 @@ class Layout: row_fig_tput, row_fig_lat, row_table, row_btn_dwnld = \ _generate_plotting_area( graph_iterative( - self.data, store_sel, self.layout, - bool(cl_normalize) + self.data, store_sel, self.layout, bool(norm) ), table_comparison( - self.data, store_sel, bool(cl_normalize) + self.data, store_sel, bool(norm) ), - gen_new_url(parsed_url, {"store_sel": store_sel}) + gen_new_url( + parsed_url, + {"store_sel": store_sel, "norm": norm} + ) ) ctrl_panel.set({ "cl-selected-options": list_tests(store_sel) @@ -1400,7 +1449,7 @@ class Layout: disabled = True ctrl_panel.set({ "btn-add-disabled": disabled, - "cl-normalize-value": cl_normalize + "cl-normalize-value": norm }) ret_val = [ diff --git a/resources/tools/dash/app/pal/report/layout.yaml b/resources/tools/dash/app/pal/report/layout.yaml index 689a91d291..c4ef13bf8b 100644 --- a/resources/tools/dash/app/pal/report/layout.yaml +++ b/resources/tools/dash/app/pal/report/layout.yaml @@ -89,18 +89,10 @@ plot-latency: 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 @@ -110,8 +102,6 @@ plot-hdrh-latency: xaxis: type: "log" title: "Percentile [%]" - # titlefont: - # size: 14 autorange: False fixedrange: True gridcolor: "rgb(230, 230, 230)" @@ -123,12 +113,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 @@ -136,105 +122,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" - -plot-throughput-speedup-analysis: - titlefont: - size: 16 - xaxis: - title: "<b>Number of Cores [Qty]</b>" - titlefont: - size: 14 - autorange: True - fixedrange: False - gridcolor: "rgb(230, 230, 230)" - linecolor: "rgb(220, 220, 220)" - linewidth: 1 - showgrid: True - showline: True - showticklabels: True - tickcolor: "rgb(238, 238, 238)" - tickmode: "linear" - tickfont: - size: 14 - zeroline: False - yaxis: - title: "<b>Packet Throughput [Mpps]</b>" - titlefont: - size: 14 - type: "linear" - gridcolor: "rgb(230, 230, 230)" - hoverformat: ".4s" - linecolor: "rgb(220, 220, 220)" - linewidth: 1 - showgrid: True - showline: True - showticklabels: True - tickcolor: "rgb(220, 220, 220)" - tickformat: ".4s" - tickfont: - size: 14 - zeroline: True - rangemode: "tozero" - range: [0, 100] - legend: - orientation: "h" - font: - size: 14 - xanchor: "left" - yanchor: "top" - x: 0 - y: -0.2 - bgcolor: "rgba(255, 255, 255, 0)" - bordercolor: "rgba(255, 255, 255, 0)" - traceorder: "normal" - autosize: False - margin: - 't': 50 - 'b': 150 - 'l': 85 - 'r': 10 - showlegend: True - width: 700 - height: 700 - paper_bgcolor: "#fff" - plot_bgcolor: "#fff" - hoverlabel: - namelength: -1 - annotations: [ - { - text: "_ _ __ ...", - align: "left", - showarrow: False, - xref: "paper", - yref: "paper", - xanchor: "left", - yanchor: "top", - x: 0, - y: -0.14, - font: { - family: "Consolas, Courier New", - size: 13 - }, - }, - { - text: " Perfect Measured Limit", - align: "left", - showarrow: False, - xref: "paper", - yref: "paper", - xanchor: "left", - yanchor: "top", - x: 0, - y: -0.15, - font: { - family: "Consolas, Courier New", - size: 13 - }, - }, - ] 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" |