rusackas opened a new pull request, #34525:
URL: https://github.com/apache/superset/pull/34525

   ## Summary
   
   This PR adopts and fixes PR #20387 by @ensky to resolve cache warmup issues 
in Superset.
   
   The cache warmup feature was unable to properly authenticate and warm up 
dashboards. This PR fixes the issue by:
   
   - Using WebDriverProxy to perform warmups instead of simple URL fetching
   - Caching dashboards instead of individual slices for better performance
   - Using `security_manager.find_user` to find user credentials
   - Refining WebDriverProxy for multiple operations with persistent driver 
instance
   
   ## Changes Made
   
   1. **Modified cache warmup logic** (`superset/tasks/cache.py`):
      - Replaced URL fetching with WebDriver-based screenshot capture
      - Changed strategies to warm up entire dashboards instead of individual 
charts
      - Added proper user authentication using `SUPERSET_CACHE_WARMUP_USER` 
config
   
   2. **Enhanced WebDriverProxy** (`superset/utils/webdriver.py`):
      - Added support for persistent driver instances to avoid recreating 
drivers
      - Implemented proper lifecycle management with `__del__` method
      - Added user parameter to constructors for better authentication flow
   
   3. **Updated screenshot utilities** (`superset/utils/screenshots.py`):
      - Modified to pass user to WebDriverProxy constructors
      - Improved type hints and compatibility
   
   4. **Added documentation** (`docs/docs/configuration/cache.mdx`):
      - Added section on Celery beat configuration for cache warmup
      - Provided example configuration for scheduled cache warmup
   
   5. **Updated tests** to reflect the new dashboard-based approach
   
   ## Test Plan
   
   - [ ] All existing tests pass
   - [ ] Pre-commit checks pass
   - [ ] Cache warmup task successfully warms up dashboards when configured
   - [ ] WebDriver properly authenticates with the configured user
   - [ ] No memory leaks from persistent WebDriver instances
   
   ## Attribution
   
   Originally by @ensky in PR #20387
   
   🤖 Generated with [Claude Code](https://claude.ai/code)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscr...@superset.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscr...@superset.apache.org
For additional commands, e-mail: notifications-h...@superset.apache.org

Reply via email to