aboutsummaryrefslogtreecommitdiffstats
path: root/resources/tools/dash/app/pal/stats/graphs.py
diff options
context:
space:
mode:
authorTibor Frank <tifrank@cisco.com>2022-09-14 15:14:25 +0200
committerTibor Frank <tifrank@cisco.com>2022-09-14 15:14:25 +0200
commit69fd124979890cac21bd0dbc7ef442563f175372 (patch)
tree8db6abea93c7daff4c3766413cc31c889a73d017 /resources/tools/dash/app/pal/stats/graphs.py
parent8ce2df561b011243f9138332058945e957d48d63 (diff)
UTI: Remove datepicker, unify font sizes
Change-Id: I074425dbfe46c6411b2e04cd9c36d20f60a3f4de Signed-off-by: Tibor Frank <tifrank@cisco.com>
Diffstat (limited to 'resources/tools/dash/app/pal/stats/graphs.py')
-rw-r--r--resources/tools/dash/app/pal/stats/graphs.py24
1 files changed, 5 insertions, 19 deletions
diff --git a/resources/tools/dash/app/pal/stats/graphs.py b/resources/tools/dash/app/pal/stats/graphs.py
index 42f23da5aa..f533d72aa8 100644
--- a/resources/tools/dash/app/pal/stats/graphs.py
+++ b/resources/tools/dash/app/pal/stats/graphs.py
@@ -17,37 +17,27 @@
import plotly.graph_objects as go
import pandas as pd
-from datetime import datetime, timedelta
-def select_data(data: pd.DataFrame, itm:str, start: datetime,
- end: datetime) -> pd.DataFrame:
+def select_data(data: pd.DataFrame, itm:str) -> pd.DataFrame:
"""Select the data for graphs from the provided data frame.
:param data: Data frame with data for graphs.
:param itm: Item (in this case job name) which data will be selected from
the input data frame.
- :param start: The date (and time) when the selected data starts.
- :param end: The date (and time) when the selected data ends.
:type data: pandas.DataFrame
:type itm: str
- :type start: datetime.datetime
- :type end: datetime.datetime
:returns: A data frame with selected data.
:rtype: pandas.DataFrame
"""
- df = data.loc[
- (data["job"] == itm) &
- (data["start_time"] >= start) & (data["start_time"] <= end)
- ].sort_values(by="start_time", ignore_index=True)
+ df = data.loc[(data["job"] == itm)].sort_values(
+ by="start_time", ignore_index=True)
df = df.dropna(subset=["duration", ])
return df
-def graph_statistics(df: pd.DataFrame, job:str, layout: dict,
- start: datetime=datetime.utcnow()-timedelta(days=180),
- end: datetime=datetime.utcnow()) -> tuple:
+def graph_statistics(df: pd.DataFrame, job:str, layout: dict) -> tuple:
"""Generate graphs:
1. Passed / failed tests,
2. Job durations
@@ -56,19 +46,15 @@ def graph_statistics(df: pd.DataFrame, job:str, layout: dict,
:param df: Data frame with input data.
:param job: The name of job which data will be presented in the graphs.
: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.
:type df: pandas.DataFrame
:type job: str
:type layout: dict
- :type start: datetime.datetime
- :type end: datetime.datetime
:returns: Tuple with two generated graphs (pased/failed tests and job
duration).
:rtype: tuple(plotly.graph_objects.Figure, plotly.graph_objects.Figure)
"""
- data = select_data(df, job, start, end)
+ data = select_data(df, job)
if data.empty:
return None, None