Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dashboard Thumbnails couldn't show at the Dashboard page, but in Home and Chart pages shows them correctly #30287

Open
3 tasks done
mpolatcan opened this issue Sep 16, 2024 · 2 comments
Assignees
Labels
dashboard Namespace | Anything related to the Dashboard global:error Related to global errors affecting the platform infra:caching Infra setup and configuration related to caching

Comments

@mpolatcan
Copy link

Bug description

When I visiting Home and Charts page, I can see thumbnails correctly, but when I visit Dashboard page I can't see thumbnails. I configured S3 caching for thumbnails like below in superset_config.py:

def init_thumbnail_cache(app, config, cache_args, cache_options) -> S3Cache:
    return S3Cache("superset-result-backend-cache", 'thumbnails/')


THUMBNAIL_CACHE_CONFIG = {'CACHE_TYPE': 'superset_config.init_thumbnail_cache'}
THUMBNAIL_SELENIUM_USER = get_env("THUMBNAIL_SELENIUM_USER", default="Admin")
THUMBNAIL_EXECUTE_AS = [ExecutorType.SELENIUM]

At the behind, I am seeing logs like below:

2024-09-16 14:45:23,017:WARNING:superset.common.utils.query_cache_manager:force_cached (QueryContext): value not found for key 9e7535a0f4d4bd1307c7e630a3756c0e
2024-09-16 14:48:42,882:INFO:superset.utils.screenshots:Attempting to get from cache: aa065c951be3dedba518d13eac81976d
2024-09-16 14:48:42,893:INFO:superset.utils.screenshots:Attempting to get from cache: 318a398cd116f164114f22aca987c5e9
2024-09-16 14:48:43,262:INFO:superset.utils.screenshots:Attempting to get from cache: 96feaa217625a1c02d3c42b62841287b
/home/superset/superset/venv/lib/python3.11/site-packages/_distutils_hack/__init__.py:31: UserWarning: Setuptools is replacing distutils. Support for replacing an already imported distutils is deprecated. In the future, this condition will fail. Register concerns at https://github.com/pypa/setuptools/issues/new?template=distutils-deprecation.yml
  warnings.warn(
2024-09-16 14:48:44,990:ERROR:superset.utils.json:JSON is not valid Expecting value: line 1 column 1 (char 0)
Traceback (most recent call last):
  File "/home/superset/superset/venv/lib/python3.11/site-packages/superset/utils/json.py", line 244, in loads
    return simplejson.loads(
           ^^^^^^^^^^^^^^^^^
  File "/home/superset/superset/venv/lib/python3.11/site-packages/simplejson/__init__.py", line 514, in loads
    return _default_decoder.decode(s)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/superset/superset/venv/lib/python3.11/site-packages/simplejson/decoder.py", line 386, in decode
    obj, end = self.raw_decode(s)
               ^^^^^^^^^^^^^^^^^^
  File "/home/superset/superset/venv/lib/python3.11/site-packages/simplejson/decoder.py", line 416, in raw_decode
    return self.scan_once(s, idx=_w(s, idx).end())
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
simplejson.errors.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
2024-09-16 14:48:45,108:ERROR:superset.utils.json:JSON is not valid Expecting value: line 1 column 1 (char 0)
Traceback (most recent call last):
  File "/home/superset/superset/venv/lib/python3.11/site-packages/superset/utils/json.py", line 244, in loads
    return simplejson.loads(
           ^^^^^^^^^^^^^^^^^
  File "/home/superset/superset/venv/lib/python3.11/site-packages/simplejson/__init__.py", line 514, in loads
    return _default_decoder.decode(s)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/superset/superset/venv/lib/python3.11/site-packages/simplejson/decoder.py", line 386, in decode
    obj, end = self.raw_decode(s)
               ^^^^^^^^^^^^^^^^^^
  File "/home/superset/superset/venv/lib/python3.11/site-packages/simplejson/decoder.py", line 416, in raw_decode
    return self.scan_once(s, idx=_w(s, idx).end())
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
simplejson.errors.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
2024-09-16 14:48:45,244:ERROR:superset.utils.json:JSON is not valid Expecting value: line 1 column 1 (char 0)
Traceback (most recent call last):
  File "/home/superset/superset/venv/lib/python3.11/site-packages/superset/utils/json.py", line 244, in loads
    return simplejson.loads(
           ^^^^^^^^^^^^^^^^^
  File "/home/superset/superset/venv/lib/python3.11/site-packages/simplejson/__init__.py", line 514, in loads
    return _default_decoder.decode(s)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/superset/superset/venv/lib/python3.11/site-packages/simplejson/decoder.py", line 386, in decode
    obj, end = self.raw_decode(s)
               ^^^^^^^^^^^^^^^^^^
  File "/home/superset/superset/venv/lib/python3.11/site-packages/simplejson/decoder.py", line 416, in raw_decode
    return self.scan_once(s, idx=_w(s, idx).end())
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
simplejson.errors.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

How to reproduce the bug

  1. Go to Dashboard page
  2. Check thumbnails on page

Screenshots/recordings

Screenshot 2024-09-16 at 17 48 40
Screenshot 2024-09-16 at 17 48 46

Superset version

master / latest-dev

Python version

3.11

Node version

16

Browser

Chrome

Additional context

I am using Apache Superset 4.1.0rc2 version :)

Checklist

  • I have searched Superset docs and Slack and didn't find a solution to my problem.
  • I have searched the GitHub issue tracker and didn't find a similar bug report.
  • I have checked Superset's logs for errors and if I found a relevant Python stacktrace, I included it here as text in the "additional context" section.
@dosubot dosubot bot added dashboard Namespace | Anything related to the Dashboard global:error Related to global errors affecting the platform infra:caching Infra setup and configuration related to caching labels Sep 16, 2024
Copy link

dosubot bot commented Sep 16, 2024

@mpolatcan Hello! I'm here to help you with any bugs, questions, or contributions.

I found some similar issues that might help you:

  1. [Question] Are dashboard thumbnails generated periodically? (Closed)

    • Solution: The issue was closed as stale. If the problem persists in current versions, it was suggested to reopen the issue or raise a new one with updated context.
    • Link to issue [1]
  2. [chart] "Unexpected error" in Dashboard thumbnails (Superset 1.0.1) (Closed)

    • Solution: Adding "can read on Chart" permission resolved the issue.
    • Link to issue [2]
  3. Why does only the thumbnail function in the chart work? The dashboard does not appear. (Closed)

    • Solution: A regression on the master branch caused dashboard thumbnails to fail, which was fixed by a specific pull request.
    • Link to issue [3]

Regarding your specific issue, the problem might be related to the caching logic for the Dashboard thumbnails. Ensure that the cache_dashboard_thumbnail function is being triggered correctly and that the thumbnail_cache is properly configured and accessible. Check the logs for any warnings or errors related to the caching process, as indicated by the logging statements in the code:

if not thumbnail_cache:
    logging.warning("No cache set, refusing to compute")
    return

If the cache is not set, the function will refuse to compute the thumbnail, which could explain why the thumbnails are not appearing on the Dashboard page [4].

Additionally, there are specific differences in how the Home, Chart, and Dashboard pages handle thumbnail caching and retrieval. The DashboardScreenshot class has specific configurations for handling thumbnails, including different default window and thumbnail sizes, URL modifications, and cache key parameters [5][6][7][4][8].

Ensure that your S3 cache is correctly configured and accessible, and verify that the cache_dashboard_thumbnail function is being called as expected.

To continue talking to Dosu, mention @dosu.

@rusackas
Copy link
Member

Assigning to @geido , but also CC-ing @yousoph / @kasiazjc - not sure how long this has gone unreported, but that makes me wonder about the utility/discoverability of the thumbnail views.

@geido geido assigned yousoph and unassigned geido Nov 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dashboard Namespace | Anything related to the Dashboard global:error Related to global errors affecting the platform infra:caching Infra setup and configuration related to caching
Projects
None yet
Development

No branches or pull requests

4 participants