aboutsummaryrefslogtreecommitdiffstats
path: root/csit.infra.dash/app/cdash/report
diff options
context:
space:
mode:
authorTibor Frank <tifrank@cisco.com>2023-01-27 08:26:25 +0100
committerPeter Mikus <peter.mikus@protonmail.ch>2023-02-01 08:34:12 +0000
commitc31372861134f29ae6eec8d98874e030e57ab5f1 (patch)
treee6a42ba2826dda42b52abcd7ad8297e11b9fd639 /csit.infra.dash/app/cdash/report
parent20432cc3b4321f16c82e22ac54d6bf979391ee71 (diff)
C-Dash: Pre-load the data from parquets
Signed-off-by: Tibor Frank <tifrank@cisco.com> Change-Id: I20792792469c10d1db2e891b76879ec8ced1b7d3
Diffstat (limited to 'csit.infra.dash/app/cdash/report')
-rw-r--r--csit.infra.dash/app/cdash/report/layout.py34
-rw-r--r--csit.infra.dash/app/cdash/report/report.py11
2 files changed, 16 insertions, 29 deletions
diff --git a/csit.infra.dash/app/cdash/report/layout.py b/csit.infra.dash/app/cdash/report/layout.py
index 50cf092ae1..495de36dec 100644
--- a/csit.infra.dash/app/cdash/report/layout.py
+++ b/csit.infra.dash/app/cdash/report/layout.py
@@ -33,7 +33,6 @@ from ..utils.trigger import Trigger
from ..utils.utils import show_tooltip, label, sync_checklists, gen_new_url, \
generate_options, get_list_group_items
from ..utils.url_processing import url_decode
-from ..data.data import Data
from .graphs import graph_iterative, select_iterative_data
@@ -76,8 +75,14 @@ class Layout:
"""The layout of the dash app and the callbacks.
"""
- def __init__(self, app: Flask, releases: list, html_layout_file: str,
- graph_layout_file: str, data_spec_file: str, tooltip_file: str) -> None:
+ def __init__(
+ self,
+ app: Flask,
+ data_iterative: 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,
@@ -86,45 +91,24 @@ class Layout:
- read tooltips from the tooltip file.
:param app: Flask application running the dash application.
- :param releases: Lis of releases to be displayed.
: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.
:type app: Flask
- :type releases: list
:type html_layout_file: str
:type graph_layout_file: str
- :type data_spec_file: str
:type tooltip_file: str
"""
# Inputs
self._app = app
- self.releases = releases
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
-
- # Read the data:
- self._data = pd.DataFrame()
- for rls in releases:
- data_mrr = Data(self._data_spec_file, True).\
- read_iterative_mrr(release=rls)
- data_mrr["release"] = rls
- data_ndrpdr = Data(self._data_spec_file, True).\
- read_iterative_ndrpdr(release=rls)
- data_ndrpdr["release"] = rls
- self._data = pd.concat(
- [self._data, data_mrr, data_ndrpdr],
- ignore_index=True,
- copy=False
- )
+ self._data = data_iterative
# Get structure of tests:
tbs = dict()
diff --git a/csit.infra.dash/app/cdash/report/report.py b/csit.infra.dash/app/cdash/report/report.py
index 9e45483086..661bb2ce7f 100644
--- a/csit.infra.dash/app/cdash/report/report.py
+++ b/csit.infra.dash/app/cdash/report/report.py
@@ -14,12 +14,16 @@
"""Instantiate the Report Dash application.
"""
import dash
+import pandas as pd
from ..utils.constants import Constants as C
from .layout import Layout
-def init_report(server, releases):
+def init_report(
+ server,
+ data_iterative: pd.DataFrame
+ ) -> dash.Dash:
"""Create a Plotly Dash dashboard.
:param server: Flask server.
@@ -37,11 +41,10 @@ def init_report(server, releases):
layout = Layout(
app=dash_app,
- releases=releases,
+ data_iterative=data_iterative,
html_layout_file=C.HTML_LAYOUT_FILE,
graph_layout_file=C.REPORT_GRAPH_LAYOUT_FILE,
- data_spec_file=C.DATA_SPEC_FILE,
- tooltip_file=C.TOOLTIP_FILE,
+ tooltip_file=C.TOOLTIP_FILE
)
dash_app.index_string = layout.html_layout
dash_app.layout = layout.add_content()