jason810496 opened a new pull request, #73594: URL: https://github.com/apache/airflow/pull/73594
- depends on: #71188 - Diff for early review: https://github.com/jason810496/airflow/compare/feature/java-sdk-arg-bindings-runtime...feature/java-sdk-native-dag-edges > **Merge order:** > 1. #71188 — Honor TaskFlow arg bindings sent by the supervisor > 2. **#EDGES — Draw a Java-authored Dag's edges with then and dependsOn** **(current one)** > 3. #CONFIG — Generate Dag and task configuration from the serialization schema > 4. #WIRED — Resolve a task's arguments from the Dag's own wiring > 5. #71189 — Declare a Dag's task graph with @Builder.Deps > 6. #71190 — Serialize native Dags to DagSerialization v3 > > Every PR targets `main` because GitHub cannot base a pull request on a branch that exists only on a fork, so these diffs are cumulative — the compare link above shows only this layer. #69757 and #71057, which the stack was originally built on, are merged. ## Why A Dag authored in Java had no way to say what runs after what. Without a Python Dag file to hold the graph every task was a root, so a Dag that Java owns end to end could not be expressed at all. This is the graph half of [ADR-0002](https://github.com/apache/airflow/blob/main/java-sdk/adr/0002-native-dag-interface.md). ## Example ```java var dag = new DagDef("java_etl"); var extract = dag.task("extract", Extract.class); var transform = dag.task("transform", Transform.class); var load = dag.task("load", Load.class); extract.then(transform).then(load); ``` ## How - `dag.task(...)` registers a task as it creates it and hands back the handle, so there is no second `addTask` to forget. - `then` is Java's spelling of Python's `>>`. It is variadic and returns the tasks it just pointed at, so `a.then(b, c).then(d)` walks a fan; `Deps.Flow.of(a, b).then(c)` opens a chain from a set, which `then` cannot do on its own. - `TaskDef.dependsOn(...)` declares the same edges from the definitions rather than the handles, and `addTask(task, upstreams)` does both in one call. - A Dag is checked as it is registered with a `Bundle`: an upstream that belongs to another Dag, and a cycle anywhere in the graph, both fail there rather than at the first task run. A Dag that fails the check is not added to the bundle. - `example/.../nativedag/InterfaceExample.java` is a Dag with no Python counterpart. --- ##### Was generative AI tooling used to co-author this PR? - [x] Yes, with help of Claude Code Opus 5 following [the guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions) -- 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]
