Skip to content

Add airflowctl tasks clear command#69320

Open
FrankYang0529 wants to merge 1 commit into
apache:mainfrom
FrankYang0529:airflow-tasks-clear
Open

Add airflowctl tasks clear command#69320
FrankYang0529 wants to merge 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
Signed-off-by: PoAn Yang <payang@apache.org>
@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

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

3 participants