Skip to content

TS SDK: add triggerDagRun to the native Dag surface - #73445

Closed
jason810496 wants to merge 6 commits into
apache:mainfrom
jason810496:feature/ts-sdk/trigger-dag-run
Closed

jason810496 wants to merge 6 commits into
apache:mainfrom
jason810496:feature/ts-sdk/trigger-dag-run

Conversation

@jason810496

@jason810496 jason810496 commented Sep 21, 2026 •

Copy link
Copy Markdown
Member

TS SDK: add triggerDagRun to the native Dag surface

Why

Decision 4 of airflow-core/adr/lang-sdk/0008-control-flow-constructs.md, amended here: triggering another Dag's run is an ordinary task the SDK's own runtime runs, so a native Dag needs no Python worker.

How

const trigger = dag.triggerDagRun({
  taskId: "trigger_downstream",
  dagId: "downstream_etl",
  waitForCompletion: true,
  deferrable: true,
});

trigger.after(loaded);
  • The task takes no TypeScript arguments, so it hands back the reference directly. A second options object carries the task's own spec.
  • It has no handler. The TypeScript runtime runs it the way Python runs TriggerDagRunOperator: it sends TriggerDagRun, polls with GetDagRunState for waitForCompletion, and with deferrable defers to DagStateTrigger, which runs in the Python triggerer, and resumes on execute_complete.
  • It inherits the Dag's queue like any other task. It serializes as a TypeScript task drawn as TriggerDagRunOperator, keeps the "Triggered DAG" link, and is recorded in dag_dependencies.
  • Values are sent as written, with no Jinja. allowedStates and failedStates take DagRunState values, checked when the Dag is built.
  • [api] base_url, [operators] default_deferrable and [triggerer] queues_enabled come from the runtime's environment, read where Python reads them, with Python's fallbacks when unset. The coordinator exports them from Airflow's config in Parse native Lang-SDK Dags with their coordinator's runtime #73842; until then only values set in the worker's environment reach the runtime.
  • ADR 0008's consequence that the trigger task runs in Python is amended.

What

  • dag.triggerDagRun, on the Dag and on a task group, and coordinator/trigger-runner.ts, which runs it.

Follow-ups

  • Decision 2 of airflow-core/adr/lang-sdk/0009-provider-operators-as-generated-dsl.md says a provider DSL task runs on a Python worker, which a task of a native Dag cannot do. It needs its own amendment.
  • The docs preview in Update the TypeScript SDK docs for Dags declared in TypeScript #73875 still says the trigger runs on a Python worker and that its Jinja is rendered.

Was generative AI tooling used to co-author this PR?

@jason810496

Copy link
Copy Markdown
Member Author

Finished in #74071.

@jason810496 jason810496 closed this Oct 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants