aboutsummaryrefslogtreecommitdiffstats
path: root/csit.infra.dash/app/cdash
diff options
context:
space:
mode:
authorTibor Frank <tifrank@cisco.com>2024-09-12 11:39:42 +0000
committerTibor Frank <tifrank@cisco.com>2024-09-12 11:39:42 +0000
commit04187e5b5ff249b182bf58944f414425c63aaee2 (patch)
treed4e7242f05dc8f1dfeaff81c7194f1cd8065d68a /csit.infra.dash/app/cdash
parent5e111af7d2eebe5c70cb629481dd2d4d72795f50 (diff)
C-Dash: set x-range max value to utc.now
- trending and statistics Change-Id: I05350c7834072d7bac101b018682ca0e051e4fef Signed-off-by: Tibor Frank <tifrank@cisco.com>
Diffstat (limited to 'csit.infra.dash/app/cdash')
-rw-r--r--csit.infra.dash/app/cdash/stats/graphs.py6
-rw-r--r--csit.infra.dash/app/cdash/stats/layout.yaml4
-rw-r--r--csit.infra.dash/app/cdash/trending/graphs.py20
-rw-r--r--csit.infra.dash/app/cdash/trending/layout.yaml6
4 files changed, 26 insertions, 10 deletions
diff --git a/csit.infra.dash/app/cdash/stats/graphs.py b/csit.infra.dash/app/cdash/stats/graphs.py
index 4b25396680..61eef41115 100644
--- a/csit.infra.dash/app/cdash/stats/graphs.py
+++ b/csit.infra.dash/app/cdash/stats/graphs.py
@@ -17,6 +17,9 @@
import plotly.graph_objects as go
import pandas as pd
+from datetime import datetime
+from pytz import UTC
+
from ..utils.constants import Constants as C
@@ -86,6 +89,7 @@ def graph_statistics(df: pd.DataFrame, job: str, layout: dict) -> tuple:
)
)
+ x_range = [data["start_time"][0], datetime.now(tz=UTC).strftime("%Y-%m-%d")]
tickvals = [0, ]
step = max(data["duration"]) / 5
for i in range(5):
@@ -97,6 +101,7 @@ def graph_statistics(df: pd.DataFrame, job: str, layout: dict) -> tuple:
f"{(val // 3600):02d}:{((val % 3600) // 60):02d}" \
for val in tickvals
]
+ layout_duration["xaxis"]["range"] = x_range
fig_duration.update_layout(layout_duration)
# Passed / failed:
@@ -124,6 +129,7 @@ def graph_statistics(df: pd.DataFrame, job: str, layout: dict) -> tuple:
)
layout_pf = layout.get("plot-stats-passed", dict())
if layout_pf:
+ layout_pf["xaxis"]["range"] = x_range
fig_passed.update_layout(layout_pf)
return fig_passed, fig_duration
diff --git a/csit.infra.dash/app/cdash/stats/layout.yaml b/csit.infra.dash/app/cdash/stats/layout.yaml
index 488654640f..70ba940910 100644
--- a/csit.infra.dash/app/cdash/stats/layout.yaml
+++ b/csit.infra.dash/app/cdash/stats/layout.yaml
@@ -15,7 +15,7 @@ plot-stats-passed:
xaxis:
title: 'Date [MMDD]'
type: "date"
- autorange: True
+ autorange: False
fixedrange: False
showgrid: True
gridcolor: "rgb(238, 238, 238)"
@@ -56,7 +56,7 @@ plot-stats-duration:
xaxis:
title: 'Date [MMDD]'
type: "date"
- autorange: True
+ autorange: False
fixedrange: False
showgrid: True
gridcolor: "rgb(238, 238, 238)"
diff --git a/csit.infra.dash/app/cdash/trending/graphs.py b/csit.infra.dash/app/cdash/trending/graphs.py
index 816b28e9af..512a9d8de9 100644
--- a/csit.infra.dash/app/cdash/trending/graphs.py
+++ b/csit.infra.dash/app/cdash/trending/graphs.py
@@ -19,6 +19,8 @@ import plotly.graph_objects as go
import pandas as pd
from numpy import nan
+from datetime import datetime
+from pytz import UTC
from ..utils.constants import Constants as C
from ..utils.utils import get_color, get_hdrh_latencies
@@ -453,11 +455,13 @@ def graph_trending(
fig_tput = None
fig_lat = None
fig_band = None
+ start_times = list()
y_units = set()
for idx, itm in enumerate(sel):
df = select_trending_data(data, itm)
if df is None or df.empty:
continue
+ start_times.append(df["start_time"][0])
if normalize:
phy = itm["phy"].rsplit("-", maxsplit=2)
@@ -528,15 +532,21 @@ def graph_trending(
y_units.update(units)
+ x_range = [min(start_times), datetime.now(tz=UTC).strftime("%Y-%m-%d")]
if fig_tput:
- fig_layout = layout.get("plot-trending-tput", dict())
- fig_layout["yaxis"]["title"] = \
+ layout_tput = layout.get("plot-trending-tput", dict())
+ layout_tput["yaxis"]["title"] = \
f"Throughput [{'|'.join(sorted(y_units))}]"
- fig_tput.update_layout(fig_layout)
+ layout_tput["xaxis"]["range"] = x_range
+ fig_tput.update_layout(layout_tput)
if fig_band:
- fig_band.update_layout(layout.get("plot-trending-bandwidth", dict()))
+ layout_band = layout.get("plot-trending-bandwidth", dict())
+ layout_band["xaxis"]["range"] = x_range
+ fig_band.update_layout(layout_band)
if fig_lat:
- fig_lat.update_layout(layout.get("plot-trending-lat", dict()))
+ layout_lat = layout.get("plot-trending-lat", dict())
+ layout_lat["xaxis"]["range"] = x_range
+ fig_lat.update_layout(layout_lat)
return fig_tput, fig_band, fig_lat
diff --git a/csit.infra.dash/app/cdash/trending/layout.yaml b/csit.infra.dash/app/cdash/trending/layout.yaml
index e4fcd29260..948ca9372b 100644
--- a/csit.infra.dash/app/cdash/trending/layout.yaml
+++ b/csit.infra.dash/app/cdash/trending/layout.yaml
@@ -16,7 +16,7 @@ plot-trending-tput:
xaxis:
title: 'Date [MMDD]'
type: "date"
- autorange: True
+ autorange: False
fixedrange: False
showgrid: True
gridcolor: "rgb(238, 238, 238)"
@@ -56,7 +56,7 @@ plot-trending-bandwidth:
xaxis:
title: 'Date [MMDD]'
type: "date"
- autorange: True
+ autorange: False
fixedrange: False
showgrid: True
gridcolor: "rgb(238, 238, 238)"
@@ -96,7 +96,7 @@ plot-trending-lat:
xaxis:
title: 'Date [MMDD]'
type: "date"
- autorange: True
+ autorange: False
fixedrange: False
showgrid: True
gridcolor: "rgb(238, 238, 238)"