Skip to content

Add task instance state store commands to airflowctl - #72746

Merged
henry3260 merged 2 commits into
apache:mainfrom
justinpakzad:feature/task-instance-state-store-airflowctl
Oct 27, 2026
Merged

henry3260 merged 2 commits into
apache:mainfrom
justinpakzad:feature/task-instance-state-store-airflowctl

Conversation

@justinpakzad

@justinpakzad justinpakzad commented Sep 8, 2026 •

Copy link
Copy Markdown
Contributor

This PR adds task state store commands to airflowctl. This would allow users to
get, list, set, update, delete, and clear key/values in a task instance's state
store via airflowctl. Unit and integration tests were added for each command and they
were also tested against an actual state store via breeze.

The commands live under a state-store subgroup within the taskinstances group, since
the state store is scoped to a single task instance. Under taskinstances state-store we have:

  • list - list all state store entries for a task instance
  • get - retrieve a single entry by key
  • set - create or overwrite a key (PUT)
  • update - update the value of an existing key (PATCH)
  • delete - delete a single key
  • clear - delete all keys for a task instance

All commands accept --map-index andclear-state-store accepts --all-map-indices to clear across every
map index.

Couple of notes:

  • The commands are nested under a state-store subgroup rather than exposed as flat
    list-state-store, get-state-store, etc.taskinstances state-store list reads more clearly and keeps
    them grouped together.
  • The command-coverage prek hook was updated since it derives expected command names from the operation method names.
  • assets already has the same set of *-state-store commands on main. Will open a follow-up PR to align them if this gets merged and we proceed with the sub-sub command approach. The commands haven't been released yet so it wouldn't be a breaking change.
Was generative AI tooling used to co-author this PR?
  • Yes (Claude Opus 4.8)

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

@justinpakzad
justinpakzad marked this pull request as ready for review September 9, 2026 21:04
@justinpakzad
justinpakzad force-pushed the feature/task-instance-state-store-airflowctl branch from 4fb2fb7 to 49dfda1 Compare September 15, 2026 21:11
@justinpakzad

Copy link
Copy Markdown
Contributor Author

Would appreciate a review on this. Thanks.

@justinpakzad
justinpakzad force-pushed the feature/task-instance-state-store-airflowctl branch from 49dfda1 to 30aeadd Compare September 26, 2026 13:45
@justinpakzad

Copy link
Copy Markdown
Contributor Author

@henry3260 would appreciate a review on this whenever you have a moment. Thanks!

@ashb

ashb commented Oct 3, 2026

Copy link
Copy Markdown
Member

list-state-store etc look a bit odd to me.

I wonder if it might be best to introduce a sub-sub command? taskinstances state-store list etc?

@justinpakzad

Copy link
Copy Markdown
Contributor Author

list-state-store etc look a bit odd to me.

I wonder if it might be best to introduce a sub-sub command? taskinstances state-store list etc?

Yea, fair callout. Will have a look at the sub command approach.

@justinpakzad
justinpakzad marked this pull request as draft October 3, 2026 14:10
@justinpakzad
justinpakzad force-pushed the feature/task-instance-state-store-airflowctl branch from 30aeadd to cdec9c2 Compare October 4, 2026 17:32
@justinpakzad
justinpakzad marked this pull request as ready for review October 4, 2026 19:01
@justinpakzad
justinpakzad requested a review from jscheffl as a code owner October 4, 2026 19:01
@justinpakzad

Copy link
Copy Markdown
Contributor Author

@ashb I've implemented your suggestion. state-store is a subgroup under taskinstances and the commands read more clearly now.

@justinpakzad
justinpakzad force-pushed the feature/task-instance-state-store-airflowctl branch 3 times, most recently from 8824647 to e40d435 Compare October 9, 2026 02:01
@justinpakzad

Copy link
Copy Markdown
Contributor Author

Requesting another review on this.

@henry3260 henry3260 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.

Thanks, leave some comments

@justinpakzad
justinpakzad force-pushed the feature/task-instance-state-store-airflowctl branch from e40d435 to d5f16bd Compare October 26, 2026 22:18
@justinpakzad

Copy link
Copy Markdown
Contributor Author

Thanks, leave some comments

Thanks for the review as always! I've addressed the feedback. Would you mind triggering the CI please?

@henry3260 henry3260 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.

Thanks for working on this Justin!

@henry3260
henry3260 enabled auto-merge (squash) October 27, 2026 02:10
@henry3260
henry3260 merged commit 3f0cea0 into apache:main Oct 27, 2026
87 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 3f0cea0 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.

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.

3 participants