You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by am...@apache.org on 2021/08/09 17:32:09 UTC
[superset] branch feat/extra_strategies created (now 40e9c76)
This is an automated email from the ASF dual-hosted git repository.
amitmiran pushed a change to branch feat/extra_strategies
in repository https://gitbox.apache.org/repos/asf/superset.git.
at 40e9c76 feat: EXTRA_CACHING_STRATEGIES
This branch includes the following new commits:
new 40e9c76 feat: EXTRA_CACHING_STRATEGIES
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
[superset] 01/01: feat: EXTRA_CACHING_STRATEGIES
Posted by am...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
amitmiran pushed a commit to branch feat/extra_strategies
in repository https://gitbox.apache.org/repos/asf/superset.git
commit 40e9c76d403ccd7d83bf70491c8c69e60bd47173
Author: amitmiran137 <am...@nielsen.com>
AuthorDate: Mon Aug 9 20:28:49 2021 +0300
feat: EXTRA_CACHING_STRATEGIES
---
superset/config.py | 4 ++++
superset/tasks/cache.py | 4 +++-
2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/superset/config.py b/superset/config.py
index 6453b0c..63f4ba1 100644
--- a/superset/config.py
+++ b/superset/config.py
@@ -47,6 +47,7 @@ from superset.utils.core import is_test, parse_boolean_string
from superset.utils.encrypt import SQLAlchemyUtilsAdapter
from superset.utils.log import DBEventLogger
from superset.utils.logging_configurator import DefaultLoggingConfigurator
+from tasks.cache import Strategy
logger = logging.getLogger(__name__)
@@ -704,6 +705,9 @@ class CeleryConfig: # pylint: disable=too-few-public-methods
CELERY_CONFIG = CeleryConfig # pylint: disable=invalid-name
+# Additional Caching strategies to be used in the CELERYBEAT_SCHEDULE config
+EXTRA_CACHING_STRATEGIES: List[Strategy] = []
+
# Set celery config to None to disable all the above configuration
# CELERY_CONFIG = None
diff --git a/superset/tasks/cache.py b/superset/tasks/cache.py
index 546eaeb..25cd838 100644
--- a/superset/tasks/cache.py
+++ b/superset/tasks/cache.py
@@ -267,7 +267,9 @@ def cache_warmup(
"""
logger.info("Loading strategy")
class_ = None
- for class_ in strategies:
+
+ extra_strategies: List[Strategy] = app.config["EXTRA_CACHING_STRATEGIES"]
+ for class_ in strategies + extra_strategies:
if class_.name == strategy_name: # type: ignore
break
else: