aboutsummaryrefslogtreecommitdiffstats
path: root/resources/tools/dash/app/pal/trending
diff options
context:
space:
mode:
Diffstat (limited to 'resources/tools/dash/app/pal/trending')
-rw-r--r--resources/tools/dash/app/pal/trending/graphs.py17
-rw-r--r--resources/tools/dash/app/pal/trending/layout.py67
-rw-r--r--resources/tools/dash/app/pal/trending/layout.yaml54
3 files changed, 15 insertions, 123 deletions
diff --git a/resources/tools/dash/app/pal/trending/graphs.py b/resources/tools/dash/app/pal/trending/graphs.py
index 06bea25466..1eff4aa889 100644
--- a/resources/tools/dash/app/pal/trending/graphs.py
+++ b/resources/tools/dash/app/pal/trending/graphs.py
@@ -99,22 +99,18 @@ def select_trending_data(data: pd.DataFrame, itm:dict) -> pd.DataFrame:
def _generate_trending_traces(ttype: str, name: str, df: pd.DataFrame,
- start: datetime, end: datetime, color: str, norm_factor: float) -> list:
+ color: str, norm_factor: float) -> list:
"""Generate the trending traces for the trending graph.
:param ttype: Test type (MRR, NDR, PDR).
:param name: The test name to be displayed as the graph title.
:param df: Data frame with test data.
- :param start: The date (and time) when the selected data starts.
- :param end: The date (and time) when the selected data ends.
:param color: The color of the trace (samples and trend line).
:param norm_factor: The factor used for normalization of the results to CPU
frequency set to Constants.NORM_FREQUENCY.
:type ttype: str
:type name: str
:type df: pandas.DataFrame
- :type start: datetime.datetime
- :type end: datetime.datetime
:type color: str
:type norm_factor: float
:returns: Traces (samples, trending line, anomalies)
@@ -124,7 +120,6 @@ def _generate_trending_traces(ttype: str, name: str, df: pd.DataFrame,
df = df.dropna(subset=[C.VALUE[ttype], ])
if df.empty:
return list()
- df = df.loc[((df["start_time"] >= start) & (df["start_time"] <= end))]
if df.empty:
return list()
@@ -274,22 +269,18 @@ def _generate_trending_traces(ttype: str, name: str, df: pd.DataFrame,
def graph_trending(data: pd.DataFrame, sel:dict, layout: dict,
- start: datetime, end: datetime, normalize: bool) -> tuple:
+ normalize: bool) -> tuple:
"""Generate the trending graph(s) - MRR, NDR, PDR and for PDR also Latences
(result_latency_forward_pdr_50_avg).
:param data: Data frame with test results.
:param sel: Selected tests.
:param layout: Layout of plot.ly graph.
- :param start: The date (and time) when the selected data starts.
- :param end: The date (and time) when the selected data ends.
:param normalize: If True, the data is normalized to CPU frquency
Constants.NORM_FREQUENCY.
:type data: pandas.DataFrame
:type sel: dict
:type layout: dict
- :type start: datetime.datetime
- :type end: datetype.datetype
:type normalize: bool
:returns: Trending graph(s)
:rtype: tuple(plotly.graph_objects.Figure, plotly.graph_objects.Figure)
@@ -316,7 +307,7 @@ def graph_trending(data: pd.DataFrame, sel:dict, layout: dict,
else:
norm_factor = 1.0
traces = _generate_trending_traces(
- itm["testtype"], name, df, start, end, get_color(idx), norm_factor
+ itm["testtype"], name, df, get_color(idx), norm_factor
)
if traces:
if not fig_tput:
@@ -325,7 +316,7 @@ def graph_trending(data: pd.DataFrame, sel:dict, layout: dict,
if itm["testtype"] == "pdr":
traces = _generate_trending_traces(
- "pdr-lat", name, df, start, end, get_color(idx), norm_factor
+ "pdr-lat", name, df, get_color(idx), norm_factor
)
if traces:
if not fig_lat:
diff --git a/resources/tools/dash/app/pal/trending/layout.py b/resources/tools/dash/app/pal/trending/layout.py
index 9e78b7c15e..eac02ced6f 100644
--- a/resources/tools/dash/app/pal/trending/layout.py
+++ b/resources/tools/dash/app/pal/trending/layout.py
@@ -25,14 +25,14 @@ from dash import callback_context, no_update, ALL
from dash import Input, Output, State
from dash.exceptions import PreventUpdate
from yaml import load, FullLoader, YAMLError
-from datetime import datetime, timedelta
+from datetime import datetime
from copy import deepcopy
from json import loads, JSONDecodeError
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, generate_options
+ 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, \
@@ -239,6 +239,7 @@ class Layout:
if self.html_layout and self.spec_tbs:
return html.Div(
id="div-main",
+ className="small",
children=[
dbc.Row(
id="row-navbar",
@@ -594,32 +595,7 @@ class Layout:
class_name="me-1",
color="info"
)
- ],
- size="md",
- )
- ]
- ),
- dbc.Row(
- class_name="gy-1",
- children=[
- dbc.Label(
- class_name="gy-1",
- children=show_tooltip(self._tooltips,
- "help-time-period", "Time Period"),
- ),
- dcc.DatePickerRange(
- id="dpr-period",
- className="d-flex justify-content-center",
- min_date_allowed=\
- datetime.utcnow() - timedelta(
- days=self.time_period),
- max_date_allowed=datetime.utcnow(),
- initial_visible_month=datetime.utcnow(),
- start_date=\
- datetime.utcnow() - timedelta(
- days=self.time_period),
- end_date=datetime.utcnow(),
- display_format="D MMM YY"
+ ]
)
]
),
@@ -662,8 +638,7 @@ class Layout:
color="info",
disabled=False
),
- ],
- size="md",
+ ]
)
]
),
@@ -711,10 +686,7 @@ class Layout:
"cl-ctrl-testtype-all-options": C.CL_ALL_DISABLED,
"btn-ctrl-add-disabled": True,
"cl-normalize-value": list(),
- "cl-selected-options": list(),
- "dpr-start-date": datetime.utcnow() - \
- timedelta(days=C.TIME_PERIOD),
- "dpr-end-date": datetime.utcnow()
+ "cl-selected-options": list()
}
self._panel = deepcopy(self._defaults)
@@ -878,8 +850,6 @@ class Layout:
Output("btn-ctrl-add", "disabled"),
Output("cl-ctrl-normalize", "value"),
Output("cl-selected", "options"), # User selection
- Output("dpr-period", "start_date"),
- Output("dpr-period", "end_date"),
State("control-panel", "data"), # Store
State("selected-tests", "data"), # Store
State("cl-selected", "value"), # User selection
@@ -895,8 +865,6 @@ class Layout:
Input("cl-ctrl-testtype-all", "value"),
Input("cl-ctrl-normalize", "value"),
Input("btn-ctrl-add", "n_clicks"),
- Input("dpr-period", "start_date"),
- Input("dpr-period", "end_date"),
Input("btn-sel-remove", "n_clicks"),
Input("btn-sel-remove-all", "n_clicks"),
Input("url", "href")
@@ -905,7 +873,7 @@ class Layout:
dd_dut: str, dd_phy: str, dd_area: str, dd_test: str, cl_core: list,
cl_core_all: list, cl_framesize: list, cl_framesize_all: list,
cl_testtype: list, cl_testtype_all: list, cl_normalize: list,
- btn_add: int, d_start: str, d_end: str, btn_remove: int,
+ btn_add: int, btn_remove: int,
btn_remove_all: int, href: str) -> tuple:
"""Update the application when the event is detected.
@@ -927,8 +895,6 @@ class Layout:
:param cl_testtype_all: Input - All test types.
:param cl_normalize: Input - Normalize the results.
:param btn_add: Input - Button "Add Selected" tests.
- :param d_start: Date and time where the data processing starts.
- :param d_end: Date and time where the data processing ends.
:param btn_remove: Input - Button "Remove selected" tests.
:param btn_remove_all: Input - Button "Remove All" tests.
:param href: Input - The URL provided by the browser.
@@ -947,8 +913,6 @@ class Layout:
:type cl_testtype_all: list
:type cl_normalize: list
:type btn_add: int
- :type d_start: str
- :type d_end: str
:type btn_remove: int
:type btn_remove_all: int
:type href: str
@@ -959,9 +923,6 @@ 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:
@@ -1218,8 +1179,6 @@ class Layout:
if url_params:
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
@@ -1269,27 +1228,23 @@ class Layout:
"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"):
+ if trigger_id in ("btn-ctrl-add", "url", "btn-sel-remove",
+ "cl-ctrl-normalize"):
if store_sel:
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(norm)),
+ bool(norm)),
gen_new_url(
parsed_url,
{
"store_sel": store_sel,
- "start": d_start,
- "end": d_end,
"norm": norm
}
)
)
ctrl_panel.set({
- "cl-selected-options": list_tests(store_sel),
- "dpr-start-date": d_start,
- "dpr-end-date": d_end
+ "cl-selected-options": list_tests(store_sel)
})
else:
row_fig_tput = C.PLACEHOLDER
diff --git a/resources/tools/dash/app/pal/trending/layout.yaml b/resources/tools/dash/app/pal/trending/layout.yaml
index 9c35d93667..1beb5226b1 100644
--- a/resources/tools/dash/app/pal/trending/layout.yaml
+++ b/resources/tools/dash/app/pal/trending/layout.yaml
@@ -28,33 +28,6 @@ plot-trending-tput:
tickcolor: "rgb(238, 238, 238)"
tickmode: "auto"
tickformat: "%m%d"
- rangeselector:
- buttons:
- - count: 14
- label: "2w"
- step: "day"
- stepmode: "backward"
- - count: 1
- label: "1m"
- step: "month"
- stepmode: "backward"
- - count: 2
- label: "2m"
- step: "month"
- stepmode: "backward"
- - count: 3
- label: "3m"
- step: "month"
- stepmode: "backward"
- - count: 4
- label: "4m"
- step: "month"
- stepmode: "backward"
- - count: 5
- label: "5m"
- step: "month"
- stepmode: "backward"
- - step: "all"
margin:
r: 20
b: 0
@@ -101,33 +74,6 @@ plot-trending-lat:
tickcolor: "rgb(238, 238, 238)"
tickmode: "auto"
tickformat: "%m%d"
- rangeselector:
- buttons:
- - count: 14
- label: "2w"
- step: "day"
- stepmode: "backward"
- - count: 1
- label: "1m"
- step: "month"
- stepmode: "backward"
- - count: 2
- label: "2m"
- step: "month"
- stepmode: "backward"
- - count: 3
- label: "3m"
- step: "month"
- stepmode: "backward"
- - count: 4
- label: "4m"
- step: "month"
- stepmode: "backward"
- - count: 5
- label: "5m"
- step: "month"
- stepmode: "backward"
- - step: "all"
margin:
r: 20
b: 0