Hi-CWJ 2021-12-14 17:28 采纳率: 28.6%
浏览 101
已结题

superset 设置缩略图不能正常显示,而且celery也报错,如何解决?

这是我的superser_config.py的配置:

from superset.typing import CacheConfig

# 源数据库配置
SQLALCHEMY_DATABASE_URI = 'mysql://root:root@localhost/superset_meta?charset=utf8'

# 汉化
BABEL_DEFAULT_LOCALE = "zh"

# 缓存配置
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',
}

# 开启缩略图
FEATURE_FLAGS = {
    "THUMBNAILS": True,
    "THUMBNAILS_SQLA_LISTENERS": True,
}

# Async selenium thumbnail task will use the following user
# 缩略图配置
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'
}

# celery配置
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

THUMBNAIL_SELENIUM_USER = "Admin"  # 指定缩略图的角色

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:8001/"

而且我也已经安装了chromedriver
运行时有报错:

...
Attempting to get from cache: abbb8ea1ad9a735006f338133d6c1b64
2021-12-21 10:57:57,764:INFO:superset.utils.screenshots:Attempting to get from cache: abbb8ea1ad9a735006f338133d6c1b64
Failed at getting from cache: abbb8ea1ad9a735006f338133d6c1b64
2021-12-21 10:57:57,771:INFO:superset.utils.screenshots:Failed at getting from cache: abbb8ea1ad9a735006f338133d6c1b64
Triggering thumbnail compute (chart id: 73) ASYNC
2021-12-21 10:57:57,775:INFO:superset.charts.api:Triggering thumbnail compute (chart id: 73) ASYNC
Attempting to get from cache: b06fdc239cb339d68ce9133515e059fd
2021-12-21 10:57:57,778:INFO:superset.utils.screenshots:Attempting to get from cache: b06fdc239cb339d68ce9133515e059fd
Failed at getting from cache: b06fdc239cb339d68ce9133515e059fd
2021-12-21 10:57:57,785:INFO:superset.utils.screenshots:Failed at getting from cache: b06fdc239cb339d68ce9133515e059fd
Attempting to get from cache: 17c67c85c07197102cfd9ab7426f09d1
Attempting to get from cache: 3ecab91cd8e314c2df7a7a2adf63f1d7
Triggering thumbnail compute (chart id: 71) ASYNC
2021-12-21 10:57:57,812:INFO:superset.utils.screenshots:Attempting to get from cache: 17c67c85c07197102cfd9ab7426f09d1
Failed at getting from cache: 17c67c85c07197102cfd9ab7426f09d1
2021-12-21 10:57:57,815:INFO:superset.utils.screenshots:Attempting to get from cache: 3ecab91cd8e314c2df7a7a2adf63f1d7
Failed at getting from cache: 3ecab91cd8e314c2df7a7a2adf63f1d7
2021-12-21 10:57:57,820:INFO:superset.charts.api:Triggering thumbnail compute (chart id: 71) ASYNC
...

在我执行celery --app=superset.tasks.celery_app:app worker --pool=prefork -O fair -c 4时,提示以下错误:

[2021-12-14 17:04:43,482: ERROR/SpawnPoolWorker-2] Process SpawnPoolWorker-2
Traceback (most recent call last):
  File "D:\Anaconda3\install\envs\superset_env\Lib\site-packages\billiard\process.py", line 327, in _bootstrap
    self.run()
  File "D:\Anaconda3\install\envs\superset_env\Lib\site-packages\billiard\process.py", line 114, in run
    self._target(*self._args, **self._kwargs)
  File "D:\Anaconda3\install\envs\superset_env\Lib\site-packages\billiard\pool.py", line 289, in __call__
    self.after_fork()
  File "D:\Anaconda3\install\envs\superset_env\Lib\site-packages\billiard\pool.py", line 421, in after_fork
    self.initializer(*self.initargs)
  File "D:\Anaconda3\install\envs\superset_env\lib\site-packages\celery\concurrency\prefork.py", line 55, in process_initializer
    app.loader.init_worker()
  File "D:\Anaconda3\install\envs\superset_env\lib\site-packages\celery\loaders\base.py", line 114, in init_worker
    self.import_default_modules()
  File "D:\Anaconda3\install\envs\superset_env\lib\site-packages\celery\loaders\base.py", line 109, in import_default_modules
    return [self.import_task_module(m) for m in self.default_modules]
  File "D:\Anaconda3\install\envs\superset_env\lib\site-packages\celery\loaders\base.py", line 109, in <listcomp>
    return [self.import_task_module(m) for m in self.default_modules]
  File "D:\Anaconda3\install\envs\superset_env\lib\site-packages\celery\loaders\base.py", line 89, in import_task_module
    return self.import_from_cwd(module)
  File "D:\Anaconda3\install\envs\superset_env\lib\site-packages\celery\loaders\base.py", line 98, in import_from_cwd
    package=package,
  File "D:\Anaconda3\install\envs\superset_env\lib\site-packages\celery\utils\imports.py", line 111, in import_from_cwd
    return imp(module, package=package)
  File "D:\Anaconda3\install\envs\superset_env\lib\site-packages\celery\loaders\base.py", line 92, in import_module
    return importlib.import_module(module, package=package)
  File "D:\Anaconda3\install\envs\superset_env\lib\importlib\__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 728, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "D:\Anaconda3\install\envs\superset_env\lib\site-packages\superset\sql_lab.py", line 37, in <module>
    from superset.db_engine_specs import BaseEngineSpec
  File "D:\Anaconda3\install\envs\superset_env\lib\site-packages\superset\db_engine_specs\__init__.py", line 43, in <module>
    from superset.db_engine_specs.base import BaseEngineSpec
  File "D:\Anaconda3\install\envs\superset_env\lib\site-packages\superset\db_engine_specs\base.py", line 61, in <module>
    from superset.models.sql_lab import Query
  File "D:\Anaconda3\install\envs\superset_env\lib\site-packages\superset\models\__init__.py", line 17, in <module>
    from . import (
  File "D:\Anaconda3\install\envs\superset_env\lib\site-packages\superset\models\alerts.py", line 55, in <module>
    class Alert(Model, AuditMixinNullable):
  File "D:\Anaconda3\install\envs\superset_env\lib\site-packages\superset\models\alerts.py", line 68, in Alert
    owners = relationship(security_manager.user_model, secondary=alert_owner)
  File "D:\Anaconda3\install\envs\superset_env\lib\site-packages\werkzeug\local.py", line 347, in __getattr__
    return getattr(self._get_current_object(), name)
AttributeError: 'NoneType' object has no attribute 'user_model'

这是因为什么导致的错误呢?是不是哪儿我配置错误呢?是不是屏幕截图的问题呢?

  • 写回答

2条回答 默认 最新

  • Hi-CWJ 2021-12-24 10:15
    关注

    此问题关闭。
    在Superset中配置缩略图时,要配置以下几个方面:

    • 安装Chromedriver
    • 配置Redis
    • 配置celery

    这些我之前已正确配置。
    此问题出现是由于系统原因,superset官方文档中说明不支持Windows系统,我在Linux运行正常

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

问题事件

  • 系统已结题 1月1日
  • 已采纳回答 12月24日
  • 修改了问题 12月21日
  • 创建了问题 12月14日

悬赏问题

  • ¥100 需要跳转番茄畅听app的adb命令
  • ¥50 寻找一位有逆向游戏盾sdk 应用程序经验的技术
  • ¥15 请问有用MZmine处理 “Waters SYNAPT G2-Si QTOF质谱仪在MSE模式下采集的非靶向数据” 的分析教程吗
  • ¥50 opencv4nodejs 如何安装
  • ¥15 adb push异常 adb: error: 1409-byte write failed: Invalid argument
  • ¥15 nginx反向代理获取ip,java获取真实ip
  • ¥15 eda:门禁系统设计
  • ¥50 如何使用js去调用vscode-js-debugger的方法去调试网页
  • ¥15 376.1电表主站通信协议下发指令全被否认问题
  • ¥15 物体双站RCS和其组成阵列后的双站RCS关系验证