pierrejeambrun commented on code in PR #74069:
URL: https://github.com/apache/airflow/pull/74069#discussion_r4193852407
##########
ts-sdk/adr/0002-native-dag-interface.md:
##########
@@ -135,6 +135,48 @@ data is the wiring object itself — `summarize({ north:
extractNorth(), south:
does. This matches `Before`/`After` in the Go SDK's native Dag interface,
spelled to TypeScript
convention.
+### Conditional branching: `if` and `else`
+
+`dag.if(handler)` is TypeScript's spelling of the construct
+[`airflow-core/adr/lang-sdk/0008`](../../airflow-core/adr/lang-sdk/0008-control-flow-constructs.md)
+names after the host language's control flow:
+
+```ts
+async function hasRows({ rows }: { rows: number }): Promise<boolean> {
+ return rows > 0;
+}
+
+const gate = dag.if(hasRows, { rows: validated });
+gate.then(loadIfReady).else(loadFallback);
Review Comment:
In python a decider is fully configurable (queue, retry, pools).
In these PR the 'taskspec' isn't supported. Maybe dag.if should accept a
trailing taskspec:
```ts
dag.if(hasRows, { rows }, { queue: "golang", retries: 2, taskId: "has_rows"
})
```
--
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]