jason810496 opened a new pull request, #74417:
URL: https://github.com/apache/airflow/pull/74417

   - **Depends on https://github.com/apache/airflow/pull/74342 get merged 
first** (its commits are cherry-picked here; only the last 5 commits are new).
   - **Diff for early review**: 
https://github.com/jason810496/airflow/compare/ae8503d15e6e8a5daa52d1a2d9a5a3096cd6d7ae...feature/go-sdk/trigger-dag-run-runtime
   - related: #74411 (e2e), #74414 (the same options for the TypeScript SDK)
   
   ## Why
   
   A Go `airflow.TriggerDagRun` task was meant to run as 
`TriggerDagRunOperator` on a Python worker, but a Python worker refuses a task 
whose Dag file is a Go bundle, so the task could never run. As ADR-0008 
decides, each Lang SDK runtime runs the trigger task itself, as the TypeScript 
SDK already does.
   
   ## How
   
   - The Go runtime finds a trigger task of a registered Dag and runs it the 
way `TriggerDagRunOperator` does:
     - checks whether the target Dag is paused, when asked;
     - pushes the run link, triggers the run, and pushes `trigger_run_id`;
     - skips or fails without retry when the run already exists;
     - waits for the run by polling, or defers to the standard provider's 
`DagStateTrigger` in the Python triggerer when `Deferrable` is set, then 
resumes in the Go runtime.
   - A trigger task takes `DagSpec.Queue` unless its `TaskSpec` sets one, so it 
is routed to the Go runtime.
   - Like the TypeScript SDK, the arguments are sent as written, with no Jinja 
rendering.
   
   ```go
   dag := airflow.Dag("go_native_trigger", airflow.DagSpec{Queue: "golang"})
   dag.Task(airflow.TriggerDagRun(airflow.TriggerDagRunSpec{
        DagID:             "report",
        LogicalDate:       time.Date(2026, 10, 1, 0, 0, 0, 0, time.UTC), // was 
a string; zero means now
        Conf:              map[string]any{"triggered_by": "go_native_trigger"},
        WaitForCompletion: true,
        Deferrable:        &deferrable,
   }), airflow.TaskSpec{TaskID: "trigger_report"})
   ```
   
   ## What
   
   - `pkg/execution`: the trigger runner, and the `TriggerDagRun`, 
`GetDagRunState` and `GetDag` calls it makes.
   - `TriggerDagRunSpec.LogicalDate` is a `time.Time`; the shared conformance 
case and `go_native.json` follow.
   - The trigger task takes the Dag's queue; `serialize.go` and the generated 
spec docs follow.
   - Docs on `TriggerDagRun`: who runs it, its queue, `Deferrable`, and no 
templating.
   
   ---
   
   ##### Was generative AI tooling used to co-author this PR?
   
   - [x] Yes, with help of Claude Code Opus 5.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]

Reply via email to