Skip to content

Add airflowctl tasks clear command - #69320

Merged
Lee-W merged 1 commit into
apache:mainfrom
FrankYang0529:airflow-tasks-clear
Jul 23, 2026
Merged

Add airflowctl tasks clear command#69320
Lee-W merged 1 commit into
apache:mainfrom
FrankYang0529:airflow-tasks-clear

Conversation

@FrankYang0529

@FrankYang0529 FrankYang0529 commented Jul 3, 2026

Copy link
Copy Markdown
Member
  • Add airflowctl tasks clear <dag_id>.
  • Add TasksOperations.clear in operations.py (POST /dags/{dag_id}/clearTaskInstances), from which the CLI command is auto-generated.
  • Make generated bool flags follow the ClearTaskInstancesBody field defaults.
  • Accept --task-ids as comma-separated ids or a JSON list of task_id / [task_id, map_index].
  • Mark the core CLI command with @deprecated_for_airflowctl("airflowctl tasks clear") and register it in test_command_deprecations.py.

Add TasksOperations.clear() in operations.py calling POST /dags/{dag_id}/clearTaskInstances. airflowctl tasks clear is auto-generated from it. Bool flags of ClearTaskInstancesBody follow the datamodel field defaults: a bare tasks clear dry-runs, --no-dry-run actually clears, and --run-on-latest-version keeps its tri-state fallback semantics. --task-ids accepts comma-separated ids or a JSON list of task_id / [task_id, map_index].


Was generative AI tooling used to co-author this PR?
  • Yes - Claude Code

  • 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.

@henry3260

Copy link
Copy Markdown
Contributor

reopen to trigger full ci test

Comment thread airflow-ctl/src/airflowctl/ctl/help_texts.yaml Outdated
@FrankYang0529
FrankYang0529 force-pushed the airflow-tasks-clear branch from bc74659 to bd41f17 Compare July 4, 2026 04:37

@henry3260 henry3260 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM! need another pair of eyes

@Lee-W Lee-W left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

a few nits, but mostly good

Comment thread airflow-ctl/tests/airflow_ctl/ctl/test_cli_config.py Outdated
Comment thread airflow-ctl/tests/airflow_ctl/ctl/test_cli_config.py Outdated
Comment thread airflow-ctl/src/airflowctl/ctl/cli_config.py Outdated
@FrankYang0529
FrankYang0529 force-pushed the airflow-tasks-clear branch 3 times, most recently from 19a531b to 7524cec Compare July 15, 2026 07:30

@henry3260 henry3260 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

That's really nice! It will be merged when ci greens

Signed-off-by: PoAn Yang <payang@apache.org>
@Lee-W
Lee-W merged commit 41613f2 into apache:main Jul 23, 2026
155 checks passed
@github-actions

Copy link
Copy Markdown
Contributor

Backport failed to create: airflow-ctl/v0-1-test. View the failure log Run details

Note: As of Merging PRs targeted for Airflow 3.X
the committer who merges the PR is responsible for backporting the PRs that are bug fixes (generally speaking) to the maintenance branches.

In matter of doubt please ask in #release-management Slack channel.

Status Branch Result
airflow-ctl/v0-1-test Commit Link

You can attempt to backport this manually by running:

cherry_picker 41613f2 airflow-ctl/v0-1-test

This should apply the commit to the airflow-ctl/v0-1-test branch and leave the commit in conflict state marking
the files that need manual conflict resolution.

After you have resolved the conflicts, you can continue the backport process by running:

cherry_picker --continue

If you don't have cherry-picker installed, see the installation guide.

@github-actions

Copy link
Copy Markdown
Contributor

Backport failed to create: v3-3-test. View the failure log Run details

Note: As of Merging PRs targeted for Airflow 3.X
the committer who merges the PR is responsible for backporting the PRs that are bug fixes (generally speaking) to the maintenance branches.

In matter of doubt please ask in #release-management Slack channel.

Status Branch Result
v3-3-test Commit Link

You can attempt to backport this manually by running:

cherry_picker 41613f2 v3-3-test

This should apply the commit to the v3-3-test branch and leave the commit in conflict state marking
the files that need manual conflict resolution.

After you have resolved the conflicts, you can continue the backport process by running:

cherry_picker --continue

If you don't have cherry-picker installed, see the installation guide.

@FrankYang0529
FrankYang0529 deleted the airflow-tasks-clear branch July 24, 2026 02:37
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.

[AIP-94] airflowctl tasks: add clear command

4 participants