Skip to content

Commit

Permalink
Use machine_auth_provider_factory for cache warmup jobs (#29)
Browse files Browse the repository at this point in the history
  • Loading branch information
kgopal492 authored and zhangvi7 committed Aug 1, 2024
1 parent f36ae68 commit 0dc5951
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions superset/tasks/cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
from sqlalchemy import and_, func

from superset import app, db, security_manager
from superset.extensions import celery_app
from superset.extensions import celery_app, machine_auth_provider_factory
from superset.models.core import Log
from superset.models.dashboard import Dashboard
from superset.models.slice import Slice
Expand Down Expand Up @@ -329,9 +329,10 @@ def cache_warmup(
return message

user = security_manager.get_user_by_username(app.config["THUMBNAIL_SELENIUM_USER"])
cookies = MachineAuthProvider.get_auth_cookies(user)
cookies = machine_auth_provider_factory.instance.get_auth_cookies(user)
cookie_str = ";".join([f"{key}={val}" for key, val in cookies.items()])
headers = {
"Cookie": f"session={cookies.get('session', '')}",
"Cookie": cookie_str,
"Content-Type": "application/json",
}

Expand Down

0 comments on commit 0dc5951

Please sign in to comment.