villebro commented on code in PR #36368:
URL: https://github.com/apache/superset/pull/36368#discussion_r2722068018


##########
docs/developer_portal/extensions/tasks.md:
##########
@@ -0,0 +1,269 @@
+---
+title: Tasks
+sidebar_position: 10
+---
+
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+
+# Global Task Framework
+
+The Global Task Framework (GTF) provides a unified way to manage background 
tasks in Apache Superset. It handles task execution, progress tracking, 
cancellation, and deduplication for both synchronous and asynchronous execution.
+
+## Quick Start
+
+### Define a Task
+
+```python
+from superset_core.api.types import task, get_context
+
+@task
+def process_data(dataset_id: int) -> None:
+    ctx = get_context()
+
+    @ctx.on_cleanup
+    def cleanup():
+        logger.info("Processing complete")
+
+    data = fetch_dataset(dataset_id)
+    process_and_cache(data)
+```
+
+### Execute Tasks
+
+```python
+# Async execution (production) - schedules on Celery
+task = process_data.schedule(dataset_id=123)
+print(task.status)  # "pending"
+
+# Sync execution (testing/development) - runs inline
+task = process_data(dataset_id=123)
+print(task.status)  # "success"
+```
+
+## Task Lifecycle
+
+```
+PENDING ──→ IN_PROGRESS ──→ SUCCESS
+   │             │  
+   │             ↓  
+   │         ABORTING ──→ ABORTED

Review Comment:
   I can verify that they are used correctly and clearly disambiguated, but 
they in fact mean different things - cancelling is a user action that only 
sometimes results in an abort operation.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to