code: def cache_dashboard_thumbnail(
      current_user: Optional[str],
      dashboard_id: int,
      force: bool = False,
      thumb_size: Optional[WindowSize] = None,
  ) -> None:
      # pylint: disable=import-outside-toplevel
      from superset.models.dashboard import Dashboard
  
      if not thumbnail_cache:
          logging.warning("No cache set, refusing to compute")
          return
      dashboard = Dashboard.get(dashboard_id)
      url = get_url_path(
          "Superset.dashboard", dashboard_id_or_slug=dashboard.id
      )
  
      logger.info("Caching dashboard: %s", url)
      _, username = get_executor(
          executor_types=current_app.config["THUMBNAIL_EXECUTE_AS"],
          model=dashboard,
          current_user=current_user,
      )
      user = security_manager.find_user(username)
      with override_user(user):
          screenshot = DashboardScreenshot(url, dashboard.digest)
          screenshot.compute_and_cache(
              user=user,
              cache=thumbnail_cache,
              force=force,
              thumb_size=thumb_size,
          )
  
file_path: superset/superset/tasks/thumbnails.py
imports: import logging
  from typing import cast, Optional
  from flask import current_app
  from superset import security_manager, thumbnail_cache
  from superset.extensions import celery_app
  from superset.tasks.utils import get_executor
  from superset.utils.core import override_user
  from superset.utils.screenshots import ChartScreenshot, DashboardScreenshot
  from superset.utils.urls import get_url_path
  from superset.utils.webdriver import WindowSize
label_desc: Use image node_id 2 for calling a global function with example usage: cache_dashboard_thumbnail(current_user, dashboard_id, force, thumb_size) without return types