jason810496 commented on code in PR #72043:
URL: https://github.com/apache/airflow/pull/72043#discussion_r3850613133


##########
go-sdk/adr/0008-taskgroup-shortcircuit-branch.md:
##########
@@ -0,0 +1,123 @@
+<!--
+ 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.
+ -->
+
+# 8. Common task constructs: TaskGroup, ShortCircuitOperator, BranchOperator, 
TriggerDagRunOperator
+
+Date: 2026-08-24
+
+## Status
+
+Proposed. Extends the `Dag` interface from [ADR 
7](0007-native-dag-interface.md) (itself unmerged, #67155/#70158) with four 
sibling methods: `TaskGroup`, `ShortCircuitOperator`, `BranchOperator`, and 
`TriggerDagRunOperator`. No PR proposes any of this yet, and no other Lang SDK 
has designed these four constructs either: this is a first proposal, not a 
catch-up with precedent.
+
+`ShortCircuitOperator`, `BranchOperator`, and `TriggerDagRunOperator` take the 
`Operator` suffix because that's what the class each one wraps is called in 
Python: `ShortCircuitOperator`, `BranchPythonOperator`, and 
`TriggerDagRunOperator`. `BranchOperator` drops the `Python` infix, since that 
part of the name is language-specific and this is the Go SDK. `TaskGroup` gets 
no suffix because it isn't one: it's a `DAGNode`, not a `BaseOperator` subclass.
+
+## Why
+
+The Native Dag interface ([ADR 7](0007-native-dag-interface.md)) only has 
`dag.Task(fn, opts...)`. Four more constructs are common enough in Python Dags 
that a native Go author will ask for them immediately: `TaskGroup` 
(visual/logical grouping, with no execution of its own), `ShortCircuitOperator` 
(what the TaskFlow decorator `@task.short_circuit` instantiates under the hood, 
to skip everything downstream when a condition is false), `BranchOperator` 
(likewise for `@task.branch`, to run only one of several downstream paths), and 
`TriggerDagRunOperator` (starts a run of a separate Dag, with no decorator 
form). Status names the underlying operator classes these map to; here they're 
introduced by the spelling most Python Dag authors actually write.
+
+## Example
+
+### TaskGroup
+
+```go
+dag := registry.AddDag(v1.DagSpec{DagId: "etl", Schedule: "@daily"})
+
+group := dag.TaskGroup("transform")
+cleaned := group.Task(cleanRows)
+validated := group.Task(validateRows, v1.Inputs(cleaned))
+
+dag.Task(nativeLoad, v1.Inputs(validated))

Review Comment:
   This is where `Then` comes into play. `a.Then(b, c)` is equivalent to `a >> 
[b, c]` in Python. I will update this example to avoid the confusion.



-- 
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]

Reply via email to