aboutsummaryrefslogtreecommitdiffstats
path: root/resources/tools/dash/app/pal/stats
diff options
context:
space:
mode:
authorTibor Frank <tifrank@cisco.com>2022-08-03 15:00:51 +0200
committerTibor Frank <tifrank@cisco.com>2022-08-03 13:57:50 +0000
commit808797d2d913eac7581a4e4cba3fb826ddbff775 (patch)
tree450d088ff8231635b2f498adc682aa07372a9e64 /resources/tools/dash/app/pal/stats
parent1f0d4ffc8d3fabe2bd7452760425e005c2970ff6 (diff)
UTI: Add Download for iterative data.
Change-Id: I79bcfc2449310d4d186146ce79b2143a33ed2d1f Signed-off-by: Tibor Frank <tifrank@cisco.com>
Diffstat (limited to 'resources/tools/dash/app/pal/stats')
-rw-r--r--resources/tools/dash/app/pal/stats/graphs.py33
-rw-r--r--resources/tools/dash/app/pal/stats/layout.py3
2 files changed, 33 insertions, 3 deletions
diff --git a/resources/tools/dash/app/pal/stats/graphs.py b/resources/tools/dash/app/pal/stats/graphs.py
index c1f58f2405..42f23da5aa 100644
--- a/resources/tools/dash/app/pal/stats/graphs.py
+++ b/resources/tools/dash/app/pal/stats/graphs.py
@@ -21,7 +21,19 @@ from datetime import datetime, timedelta
def select_data(data: pd.DataFrame, itm:str, start: datetime,
end: datetime) -> 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[
@@ -36,7 +48,24 @@ def select_data(data: pd.DataFrame, itm:str, start: datetime,
def graph_statistics(df: pd.DataFrame, job:str, layout: dict,
start: datetime=datetime.utcnow()-timedelta(days=180),
end: datetime=datetime.utcnow()) -> tuple:
- """
+ """Generate graphs:
+ 1. Passed / failed tests,
+ 2. Job durations
+ with additional information shown in hover.
+
+ :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)
diff --git a/resources/tools/dash/app/pal/stats/layout.py b/resources/tools/dash/app/pal/stats/layout.py
index 8df6d53bac..1d271cb265 100644
--- a/resources/tools/dash/app/pal/stats/layout.py
+++ b/resources/tools/dash/app/pal/stats/layout.py
@@ -800,7 +800,8 @@ class Layout:
data = select_data(self.data, job, get_date(start), get_date(end))
data = data.drop(columns=["job", ])
- return dcc.send_data_frame(data.T.to_csv, f"{job}-stats.csv")
+ return dcc.send_data_frame(
+ data.T.to_csv, f"{job}-{C.STATS_DOWNLOAD_FILE_NAME}")
@app.callback(
Output("row-metadata", "children"),