mirror of
https://github.com/apache/superset.git
synced 2026-04-07 18:35:15 +00:00
refactor(core): reorganize superset-core packages into feature-based structure (#38448)
This commit is contained in:
committed by
GitHub
parent
5f0efd2be9
commit
357e35dc62
@@ -50,7 +50,7 @@ When GTF is considered stable, it will replace legacy Celery tasks for built-in
|
||||
### Define a Task
|
||||
|
||||
```python
|
||||
from superset_core.api.tasks import task, get_context
|
||||
from superset_core.tasks.decorators import task, get_context
|
||||
|
||||
@task
|
||||
def process_data(dataset_id: int) -> None:
|
||||
@@ -245,7 +245,8 @@ Always implement an abort handler for long-running tasks. This allows users to c
|
||||
Set a timeout to automatically abort tasks that run too long:
|
||||
|
||||
```python
|
||||
from superset_core.api.tasks import task, get_context, TaskOptions
|
||||
from superset_core.tasks.decorators import task, get_context
|
||||
from superset_core.tasks.types import TaskOptions
|
||||
|
||||
# Set default timeout in decorator
|
||||
@task(timeout=300) # 5 minutes
|
||||
@@ -299,7 +300,7 @@ Timeouts require an abort handler to be effective. Without one, the timeout trig
|
||||
Use `task_key` to prevent duplicate task execution:
|
||||
|
||||
```python
|
||||
from superset_core.api.tasks import TaskOptions
|
||||
from superset_core.tasks.types import TaskOptions
|
||||
|
||||
# Without key - creates new task each time (random UUID)
|
||||
task1 = my_task.schedule(x=1)
|
||||
@@ -331,7 +332,8 @@ print(task2.status) # "success" (terminal status)
|
||||
## Task Scopes
|
||||
|
||||
```python
|
||||
from superset_core.api.tasks import task, TaskScope
|
||||
from superset_core.tasks.decorators import task
|
||||
from superset_core.tasks.types import TaskScope
|
||||
|
||||
@task # Private by default
|
||||
def private_task(): ...
|
||||
|
||||
Reference in New Issue
Block a user