airflow icon indicating copy to clipboard operation
airflow copied to clipboard

Add task instance management commands to airflowctl CLI

Open Suraj-kumar00 opened this issue 6 months ago • 6 comments

Adds task instance management support to the airflowctl CLI, enabling users to get, list, clear, and update task instances directly from the terminal.

Closes: #61547 Related: #66173


Changes

airflow-ctl/src/airflowctl/api/operations.py

  • Added TasksOperations class (matching Airflow core CLI naming) with get, list, clear, and update methods
  • Restored PluginsOperations class that was lost during merge with main (#64935)

airflow-ctl/src/airflowctl/api/client.py

  • Added tasks property to Client for auto-generated CLI command wiring
  • Restored plugins property that was lost during merge with main

airflow-ctl/src/airflowctl/ctl/cli_config.py

  • Added "clear" to output_command_list for correct CLI output handling

airflow-ctl/src/airflowctl/ctl/help_texts.yaml

  • Added tasks: section with help text for all four subcommands

scripts/in_container/run_capture_airflowctl_help.py

  • Added "tasks" to the commands list for SVG/help image generation

airflow-ctl/tests/airflow_ctl/api/test_operations.py

  • Added TestTasksOperations with 7 unit tests covering get, list, clear, and update
  • Restored TestPluginsOperations tests lost during merge

airflow-ctl-tests/tests/airflowctl_tests/test_airflowctl_commands.py

  • Added end-to-end integration tests for all 4 tasks commands using positional arguments

CLI Commands

airflowctl tasks list   <dag_id> <dag_run_id>
airflowctl tasks get    <dag_id> <dag_run_id> <task_id>
airflowctl tasks clear  <dag_id> [--dry-run] [--only-failed] [--task-ids t1,t2]
airflowctl tasks update <dag_id> <dag_run_id> <task_id> [--new-state <state>] [--note <note>]
Screenshot 2026-06-04 at 1 21 52 AM Screenshot 2026-06-04 at 1 39 47 AM

Suraj-kumar00 avatar Jun 03 '26 09:06 Suraj-kumar00

Hello @potiuk, Could you please review now and the CI Pipeline can be run?

Also could you help me get this that do i have to do the testing manually on local? This is taking so much time locally!!!

Suraj-kumar00 avatar Jun 03 '26 12:06 Suraj-kumar00

@Suraj-kumar00 A few things need addressing before review — see our Pull Request quality criteria.

  • :x: Pre-commit / static checks. See docs.

No rush.

Note: This comment was drafted by an AI-assisted triage tool and may contain mistakes. Once you have addressed the points above, an Apache Airflow maintainer — a real person — will take the next look at your PR. We use this two-stage triage process so that our maintainers' limited time is spent where it matters most: the conversation with you.

potiuk avatar Jun 09 '26 08:06 potiuk

Hi @potiuk, I'll make the changes tonight!

Suraj-kumar00 avatar Jun 09 '26 08:06 Suraj-kumar00

Hello @henry3260,

I'm looking into this. Thanks for the review!

Suraj-kumar00 avatar Jun 17 '26 15:06 Suraj-kumar00

Hi @henry3260 @potiuk,

I have made the changes as per the feedback, could you please review?

Suraj-kumar00 avatar Jun 21 '26 14:06 Suraj-kumar00

Hi @henry3260 @potiuk,

Let me know the feedback once you get the time to look into this.

Thanks!

Suraj-kumar00 avatar Jun 23 '26 16:06 Suraj-kumar00

Hello @nailo2c, thanks for the review I'll be pushing the changes soon, and will keep you posted on this.

Suraj-kumar00 avatar Jul 06 '26 15:07 Suraj-kumar00

Hi @potiuk, I'll be able to push the changes tomorrow. Thanks

Suraj-kumar00 avatar Jul 08 '26 19:07 Suraj-kumar00

Hi @nailo2c @potiuk,

I have made the changes as per the feedback, could you please review?

Suraj-kumar00 avatar Jul 10 '26 05:07 Suraj-kumar00

Could you address the requested changes from henry3260 and bugraoz93?

aaron-y-chen avatar Jul 10 '26 08:07 aaron-y-chen

Could you address the requested changes from henry3260 and bugraoz93?

All addressed in the latest push: henry3260's bool-defaults issue is fixed by sourcing flag defaults from the datamodels (see thread above), his pool test question was resolved by reverting that file, and the help images/hashes are regenerated. bugraoz93's requests (positional required params, tasks naming to match core CLI) are in. The branch is also squashed onto latest main for a clean diff. One open question remains on the operations class naming, see ashb's thread.

Suraj-kumar00 avatar Jul 12 '26 15:07 Suraj-kumar00