feat: add global task framework (#36368)

This commit is contained in:
Ville Brofeldt
2026-02-09 10:45:56 -08:00
committed by GitHub
parent 6984e93171
commit 59dd2fa385
89 changed files with 15535 additions and 291 deletions

View File

@@ -218,6 +218,7 @@ class SupersetAppInitializer: # pylint: disable=too-many-public-methods
)
from superset.views.sqllab import SqllabView
from superset.views.tags import TagModelView, TagView
from superset.views.tasks import TaskModelView
from superset.views.themes import ThemeModelView
from superset.views.user_info import UserInfoView
from superset.views.user_registrations import UserRegistrationsView
@@ -275,6 +276,11 @@ class SupersetAppInitializer: # pylint: disable=too-many-public-methods
appbuilder.add_api(ExtensionsRestApi)
if feature_flag_manager.is_feature_enabled("GLOBAL_TASK_FRAMEWORK"):
from superset.tasks.api import TaskRestApi
appbuilder.add_api(TaskRestApi)
#
# Setup regular views
#
@@ -408,6 +414,18 @@ class SupersetAppInitializer: # pylint: disable=too-many-public-methods
),
)
appbuilder.add_view(
TaskModelView,
"Tasks",
label=_("Tasks"),
icon="fa-clock-o",
category="Manage",
category_label=_("Manage"),
menu_cond=lambda: feature_flag_manager.is_feature_enabled(
"GLOBAL_TASK_FRAMEWORK"
),
)
#
# Setup views with no menu
#
@@ -588,6 +606,7 @@ class SupersetAppInitializer: # pylint: disable=too-many-public-methods
self.configure_async_queries()
self.configure_ssh_manager()
self.configure_stats_manager()
self.configure_task_manager()
# Hook that provides administrators a handle on the Flask APP
# after initialization
@@ -928,6 +947,13 @@ class SupersetAppInitializer: # pylint: disable=too-many-public-methods
if feature_flag_manager.is_feature_enabled("GLOBAL_ASYNC_QUERIES"):
async_query_manager_factory.init_app(self.superset_app)
def configure_task_manager(self) -> None:
"""Initialize the TaskManager for GTF realtime notifications."""
if feature_flag_manager.is_feature_enabled("GLOBAL_TASK_FRAMEWORK"):
from superset.tasks.manager import TaskManager
TaskManager.init_app(self.superset_app)
def register_blueprints(self) -> None:
# Register custom blueprints from config
for bp in self.config["BLUEPRINTS"]: