X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=csit.infra.dash%2Fapp%2Fcdash%2Ftrending%2Flayout.py;h=87d11626d4b1cd559b131bdd5f096d1db8074a4c;hb=f578663642305f144f76ddadf0370701147f18ff;hp=1866183da0596f6e7d2a6ac21e06e7b9dd96008f;hpb=4d03dd53c2d77bf2e35a07ed3a5a95f323c3a370;p=csit.git diff --git a/csit.infra.dash/app/cdash/trending/layout.py b/csit.infra.dash/app/cdash/trending/layout.py index 1866183da0..87d11626d4 100644 --- a/csit.infra.dash/app/cdash/trending/layout.py +++ b/csit.infra.dash/app/cdash/trending/layout.py @@ -34,11 +34,9 @@ from ..utils.control_panel import ControlPanel from ..utils.trigger import Trigger from ..utils.telemetry_data import TelemetryData from ..utils.utils import show_tooltip, label, sync_checklists, gen_new_url, \ - generate_options, get_list_group_items + generate_options, get_list_group_items, graph_hdrh_latency from ..utils.url_processing import url_decode -from ..data.data import Data -from .graphs import graph_trending, graph_hdrh_latency, select_trending_data, \ - graph_tm_trending +from .graphs import graph_trending, select_trending_data, graph_tm_trending # Control panel partameters and their default values. @@ -74,9 +72,13 @@ class Layout: """The layout of the dash app and the callbacks. """ - def __init__(self, app: Flask, html_layout_file: str, - graph_layout_file: str, data_spec_file: str, tooltip_file: str, - time_period: str=None) -> None: + def __init__(self, + app: Flask, + data_trending: pd.DataFrame, + html_layout_file: str, + graph_layout_file: str, + tooltip_file: str + ) -> None: """Initialization: - save the input parameters, - read and pre-process the data, @@ -85,62 +87,39 @@ class Layout: - read tooltips from the tooltip file. :param app: Flask application running the dash application. + :param data_trending: Pandas dataframe with trending data. :param html_layout_file: Path and name of the file specifying the HTML layout of the dash application. :param graph_layout_file: Path and name of the file with layout of plot.ly graphs. - :param data_spec_file: Path and name of the file specifying the data to - be read from parquets for this application. :param tooltip_file: Path and name of the yaml file specifying the tooltips. - :param time_period: It defines the time period for data read from the - parquets in days from now back to the past. :type app: Flask + :type data_trending: pandas.DataFrame :type html_layout_file: str :type graph_layout_file: str - :type data_spec_file: str :type tooltip_file: str - :type time_period: int """ # Inputs self._app = app + self._data = data_trending self._html_layout_file = html_layout_file self._graph_layout_file = graph_layout_file - self._data_spec_file = data_spec_file self._tooltip_file = tooltip_file - self._time_period = time_period - - # Read the data: - data_mrr = Data( - data_spec_file=self._data_spec_file, - debug=True - ).read_trending_mrr(days=self._time_period) - - data_ndrpdr = Data( - data_spec_file=self._data_spec_file, - debug=True - ).read_trending_ndrpdr(days=self._time_period) - - self._data = pd.concat( - [data_mrr, data_ndrpdr], - ignore_index=True, - copy=False - ) # Get structure of tests: tbs = dict() - for _, row in self._data[["job", "test_id"]].drop_duplicates().\ - iterrows(): + cols = ["job", "test_id", "test_type", "tg_type"] + for _, row in self._data[cols].drop_duplicates().iterrows(): lst_job = row["job"].split("-") dut = lst_job[1] - ttype = lst_job[3] tbed = "-".join(lst_job[-2:]) lst_test = row["test_id"].split(".") if dut == "dpdk": area = "dpdk" else: - area = "-".join(lst_test[3:-2]) + area = ".".join(lst_test[3:-2]) suite = lst_test[-2].replace("2n1l-", "").replace("1n1l-", "").\ replace("2n-", "") test = lst_test[-1] @@ -179,14 +158,23 @@ class Layout: tbs[dut][infra][area][test]["frame-size"].append( framesize.upper() ) - if ttype == "mrr": + if row["test_type"] == "mrr": if "MRR" not in tbs[dut][infra][area][test]["test-type"]: tbs[dut][infra][area][test]["test-type"].append("MRR") - elif ttype == "ndrpdr": + elif row["test_type"] == "ndrpdr": if "NDR" not in tbs[dut][infra][area][test]["test-type"]: tbs[dut][infra][area][test]["test-type"].extend( ("NDR", "PDR") ) + elif row["test_type"] == "hoststack": + if row["tg_type"] in ("iperf", "vpp"): + if "BPS" not in tbs[dut][infra][area][test]["test-type"]: + tbs[dut][infra][area][test]["test-type"].append("BPS") + elif row["tg_type"] == "ab": + if "CPS" not in tbs[dut][infra][area][test]["test-type"]: + tbs[dut][infra][area][test]["test-type"].extend( + ("CPS", "RPS") + ) self._spec_tbs = tbs # Read from files: @@ -625,7 +613,7 @@ class Layout: class_name="overflow-auto p-0", id="lg-selected", children=[], - style={"max-height": "14em"}, + style={"max-height": "20em"}, flush=True ) ] @@ -1099,7 +1087,7 @@ class Layout: try: store_sel = literal_eval(url_params["store_sel"][0]) normalize = literal_eval(url_params["norm"][0]) - except (KeyError, IndexError): + except (KeyError, IndexError, AttributeError): pass if store_sel: last_test = store_sel[-1]