aboutsummaryrefslogtreecommitdiffstats
path: root/csit.infra.dash/app/cdash/trending
diff options
context:
space:
mode:
Diffstat (limited to 'csit.infra.dash/app/cdash/trending')
-rw-r--r--csit.infra.dash/app/cdash/trending/layout.py39
-rw-r--r--csit.infra.dash/app/cdash/trending/trending.py11
2 files changed, 17 insertions, 33 deletions
diff --git a/csit.infra.dash/app/cdash/trending/layout.py b/csit.infra.dash/app/cdash/trending/layout.py
index 1866183da0..2d65567489 100644
--- a/csit.infra.dash/app/cdash/trending/layout.py
+++ b/csit.infra.dash/app/cdash/trending/layout.py
@@ -36,7 +36,6 @@ from ..utils.telemetry_data import TelemetryData
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_trending, graph_hdrh_latency, select_trending_data, \
graph_tm_trending
@@ -74,9 +73,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,48 +88,26 @@ 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()
diff --git a/csit.infra.dash/app/cdash/trending/trending.py b/csit.infra.dash/app/cdash/trending/trending.py
index a098a8d74f..a9dfbc1987 100644
--- a/csit.infra.dash/app/cdash/trending/trending.py
+++ b/csit.infra.dash/app/cdash/trending/trending.py
@@ -14,12 +14,16 @@
"""Instantiate the Trending Dash application.
"""
import dash
+import pandas as pd
from ..utils.constants import Constants as C
from .layout import Layout
-def init_trending(server, time_period=None):
+def init_trending(
+ server,
+ data_trending: pd.DataFrame
+ ) -> dash.Dash:
"""Create a Plotly Dash dashboard.
:param server: Flask server.
@@ -37,11 +41,10 @@ def init_trending(server, time_period=None):
layout = Layout(
app=dash_app,
+ data_trending=data_trending,
html_layout_file=C.HTML_LAYOUT_FILE,
graph_layout_file=C.TREND_GRAPH_LAYOUT_FILE,
- data_spec_file=C.DATA_SPEC_FILE,
- tooltip_file=C.TOOLTIP_FILE,
- time_period=time_period
+ tooltip_file=C.TOOLTIP_FILE
)
dash_app.index_string = layout.html_layout
dash_app.layout = layout.add_content()