aboutsummaryrefslogtreecommitdiffstats
path: root/csit.infra.dash/app/cdash/__init__.py
diff options
context:
space:
mode:
authorTibor Frank <tifrank@cisco.com>2023-01-27 08:26:25 +0100
committerPeter Mikus <peter.mikus@protonmail.ch>2023-02-01 08:34:12 +0000
commitc31372861134f29ae6eec8d98874e030e57ab5f1 (patch)
treee6a42ba2826dda42b52abcd7ad8297e11b9fd639 /csit.infra.dash/app/cdash/__init__.py
parent20432cc3b4321f16c82e22ac54d6bf979391ee71 (diff)
C-Dash: Pre-load the data from parquets
Signed-off-by: Tibor Frank <tifrank@cisco.com> Change-Id: I20792792469c10d1db2e891b76879ec8ced1b7d3
Diffstat (limited to 'csit.infra.dash/app/cdash/__init__.py')
-rw-r--r--csit.infra.dash/app/cdash/__init__.py29
1 files changed, 24 insertions, 5 deletions
diff --git a/csit.infra.dash/app/cdash/__init__.py b/csit.infra.dash/app/cdash/__init__.py
index c21e2c28d5..77722c78bd 100644
--- a/csit.infra.dash/app/cdash/__init__.py
+++ b/csit.infra.dash/app/cdash/__init__.py
@@ -15,11 +15,13 @@
"""
import logging
+import pandas as pd
from flask import Flask
from flask_assets import Environment, Bundle
from .utils.constants import Constants as C
+from .data.data import Data
def init_app():
@@ -55,24 +57,41 @@ def init_app():
assets.register("sass_all", sass_bundle)
sass_bundle.build()
- # Set the time period for Trending
if C.TIME_PERIOD is None or C.TIME_PERIOD > C.MAX_TIME_PERIOD:
time_period = C.MAX_TIME_PERIOD
else:
time_period = C.TIME_PERIOD
+ data = Data(
+ data_spec_file=C.DATA_SPEC_FILE,
+ ).read_all_data(days=time_period)
+
# Import Dash applications.
from .news.news import init_news
- app = init_news(app)
+ app = init_news(
+ app,
+ data_stats=data["statistics"],
+ data_trending=data["trending"]
+ )
from .stats.stats import init_stats
- app = init_stats(app, time_period=time_period)
+ app = init_stats(
+ app,
+ data_stats=data["statistics"],
+ data_trending=data["trending"]
+ )
from .trending.trending import init_trending
- app = init_trending(app, time_period=time_period)
+ app = init_trending(
+ app,
+ data_trending=data["trending"]
+ )
from .report.report import init_report
- app = init_report(app, releases=C.RELEASES)
+ app = init_report(
+ app,
+ data_iterative=data["iterative"]
+ )
return app