按照官网文档,修改缩略图相关配置
To configure your application, you need to create a file superset_config.py and add it to your PYTHONPATH.
echo $PYTHONPATH
/etc/superset:/home/superset:
在/home/superset 下创建superset_config.py内容如下:
from superset.typing import CacheConfig
FEATURE_FLAGS = {
"THUMBNAILS": True,
"THUMBNAILS_SQLA_LISTENERS": True,
"DASHBOARD_CACHE": True,
}
CACHE_CONFIG = {
'CACHE_TYPE': 'redis',
'CACHE_DEFAULT_TIMEOUT': 60 * 60 * 24,
'CACHE_KEY_PREFIX': 'superset_',
'CACHE_REDIS_HOST': 'localhost',
'CACHE_REDIS_PORT': 6379,
'CACHE_REDIS_DB': 0,
'CACHE_REDIS_URL': 'redis://localhost:6379/0'
}
DATA_CACHE_CONFIG = {
'CACHE_TYPE': 'redis',
'CACHE_DEFAULT_TIMEOUT': 60 * 60 * 24, # 1 day default (in secs)
'CACHE_KEY_PREFIX': 'superset_results',
'CACHE_REDIS_URL': 'redis://localhost:6379/0',
}
# Async selenium thumbnail task will use the following user
THUMBNAIL_SELENIUM_USER = "admin"
THUMBNAIL_CACHE_CONFIG: CacheConfig = {
'CACHE_TYPE': 'redis',
'CACHE_DEFAULT_TIMEOUT': 24*60*60*7,
'CACHE_KEY_PREFIX': 'thumbnail_',
'CACHE_NO_NULL_WARNING': True,
'CACHE_REDIS_URL': 'redis://localhost:6379/0'
}
class CeleryConfig(object):
BROKER_URL = "redis://localhost:6379/0"
CELERY_IMPORTS = ("superset.sql_lab", "superset.tasks", "superset.tasks.thumbnails",)
CELERY_RESULT_BACKEND = "redis://localhost:6379/0"
CELERYD_PREFETCH_MULTIPLIER = 10
CELERY_ACKS_LATE = True
CELERY_CONFIG = CeleryConfig
WEBDRIVER_TYPE= "chrome"
# for older versions this was EMAIL_REPORTS_WEBDRIVER = "chrome"
WEBDRIVER_OPTION_ARGS = [
"--force-device-scale-factor=2.0",
"--high-dpi-support=2.0",
"--headless",
"--disable-gpu",
"--disable-dev-shm-usage",
"--no-sandbox",
"--disable-setuid-sandbox",
"--disable-extensions",
]
# The base URL to query for accessing the user interface
WEBDRIVER_BASEURL = "http://localhost:8088/"
重启一下容器
docker restart my_superset
启动redis
nohup redis-server > ./redis.log &
nohup celery --app=superset.tasks.celery_app:app worker --pool=prefork --max-tasks-per-child=128 -O fair -c 4 > ./celery.log &
如果出现内存溢出情况,可以添加--max-tasks-per-child参数
文档原文:
-
在某些情况下,如果您发现大量泄漏的 geckodriver 进程,请尝试使用以下命令运行 celery 进程 celery worker --pool=prefork --max-tasks-per-child=128 ...
启动celery
此命令会加载superset-config.py中CeleryConfig相关配置
celery --app=superset.tasks.celery_app:app worker --pool=prefork -O fair -c 4
参考官网文档 : Async Queries via Celery | superset doc
参考文档
superset官方文档:
Async Queries via Celery | superset doc
Installation & Configuration — Apache Superset documentation
Celery 中文手册:
其他:
https://github.com/apache/superset/issues/12867#issuecomment-771770878
https://www.gitmemory.com/issue/apache/incubator-superset/7972/522403473
Thumbnails not showing/issues with computation on worker · Issue #13483 · apache/superset · GitHub
上一篇
下一篇