Skip to content

Add DagRunType for operator#63733

Merged
pierrejeambrun merged 4 commits intoapache:mainfrom
henry3260:add-run-type-operator
Apr 2, 2026
Merged

Add DagRunType for operator#63733
pierrejeambrun merged 4 commits intoapache:mainfrom
henry3260:add-run-type-operator

Conversation

@henry3260
Copy link
Copy Markdown
Contributor

@henry3260 henry3260 commented Mar 16, 2026

Why

  • The Execution API previously used the MANUAL run type for operator-triggered DAG runs, which caused ambiguity and made it difficult to distinguish between user-initiated and operator-initiated runs.

What

  • Added OPERATOR to the DagRunType enum and updated all relevant code paths to use OPERATOR for operator-triggered DAG runs.
  • Updated the Execution API route to strictly enforce OPERATOR as the only allowed run type.
Was generative AI tooling used to co-author this PR?
  • Yes (please specify the tool below)

  • Read the Pull Request Guidelines for more information. Note: commit author/co-author name and email in commits become permanently public when merged.
  • For fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
  • When adding dependency, check compliance with the ASF 3rd Party License Policy.
  • For significant user-facing changes create newsfragment: {pr_number}.significant.rst, in airflow-core/newsfragments. You can add this file in a follow-up commit after the PR is created so you know the PR number.

@boring-cyborg boring-cyborg bot added area:airflow-ctl area:API Airflow's REST/HTTP API area:task-sdk area:UI Related to UI/UX. For Frontend Developers. labels Mar 16, 2026
@henry3260 henry3260 changed the title Execution API: Enforce OPERATOR run type for operator-triggered DAG runs Add DagRunType for operator Mar 16, 2026
@henry3260 henry3260 force-pushed the add-run-type-operator branch from 6382118 to d1e4052 Compare March 16, 2026 15:03
@henry3260 henry3260 marked this pull request as ready for review March 16, 2026 16:24
Copilot AI review requested due to automatic review settings March 16, 2026 16:24
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new DAG run type (operator) so that DAG runs created via TriggerDagRunOperator/execution API can be distinguished from manual/UI/CLI triggers across Python, OpenAPI clients, and the UI.

Changes:

  • Add DagRunType.OPERATOR = "operator" across core + generated client datamodels.
  • Update the Execution API trigger endpoint to create operator-typed DagRuns and enforce allowed_run_types accordingly.
  • Regenerate/update OpenAPI artifacts and UI rendering for the new run type.

Reviewed changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
task-sdk/src/airflow/sdk/api/datamodels/_generated.py Adds operator to generated DagRunType for the Task SDK models.
airflow-ctl/src/airflowctl/api/datamodels/generated.py Adds operator to generated DagRunType for airflowctl models.
airflow-core/src/airflow/utils/types.py Adds DagRunType.OPERATOR in core enum.
airflow-core/src/airflow/api/common/trigger_dag.py Allows callers to specify run_type (default manual) and validates against allowed_run_types.
airflow-core/src/airflow/api_fastapi/execution_api/routes/dag_runs.py Execution API now triggers runs as run_type=operator and enforces operator run permission.
airflow-core/tests/unit/api_fastapi/execution_api/versions/head/test_dag_runs.py Asserts triggered run uses DagRunType.OPERATOR and adds additional denial coverage.
airflow-core/tests/unit/api/common/test_trigger_dag.py Adds unit test for operator run denial when only manual is allowed.
airflow-core/src/airflow/ui/src/components/RunTypeIcon.tsx Displays an icon for run_type="operator".
airflow-core/src/airflow/ui/openapi-gen/requests/types.gen.ts Updates generated TS union type to include operator.
airflow-core/src/airflow/ui/openapi-gen/requests/schemas.gen.ts Updates generated TS schema enum to include operator.
airflow-core/src/airflow/api_fastapi/core_api/openapi/v2-rest-api-generated.yaml Adds operator to DagRunType enum in generated OpenAPI.
airflow-core/src/airflow/api_fastapi/core_api/openapi/_private_ui.yaml Adds operator to DagRunType enum in UI OpenAPI.

You can also share your feedback on Copilot code review. Take the survey.

Copy link
Copy Markdown
Member

@jason810496 jason810496 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, LGTM overall!

@henry3260 henry3260 force-pushed the add-run-type-operator branch 3 times, most recently from 5147f3e to f47fb76 Compare March 17, 2026 07:48
@henry3260 henry3260 force-pushed the add-run-type-operator branch 7 times, most recently from e5a7cc7 to 937a827 Compare March 17, 2026 17:34
@henry3260 henry3260 force-pushed the add-run-type-operator branch from 937a827 to db40fd0 Compare March 17, 2026 17:54
@henry3260 henry3260 requested a review from jason810496 March 18, 2026 01:15
Copy link
Copy Markdown
Member

@jason810496 jason810496 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! LGTM overall, only the following nits need to be addressed.

Copy link
Copy Markdown
Member

@pierrejeambrun pierrejeambrun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall looking good.

A few nits/questions

Copy link
Copy Markdown
Member

@pierrejeambrun pierrejeambrun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM thanks.

@pierrejeambrun pierrejeambrun added this to the Airflow 3.2.1 milestone Apr 2, 2026
@pierrejeambrun pierrejeambrun merged commit ed51aff into apache:main Apr 2, 2026
148 checks passed
@uranusjr
Copy link
Copy Markdown
Member

uranusjr commented Apr 7, 2026

Should this be in 3.2.1? It does not feel like a bugfix to me, i.e. should belong to a minor release (3.3)

@kaxil kaxil modified the milestones: Airflow 3.2.1, Airflow 3.3.0 Apr 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:airflow-ctl area:API Airflow's REST/HTTP API area:task-sdk area:UI Related to UI/UX. For Frontend Developers. ready for maintainer review Set after triaging when all criteria pass.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants