Skip to content

Add async asset state store accessors for async tasks and watchers - #71354

Closed
desusaiteja wants to merge 1 commit into
apache:mainfrom
desusaiteja:async-task-state-access-66842
Closed

desusaiteja wants to merge 1 commit into
apache:mainfrom
desusaiteja:async-task-state-access-66842

Conversation

@desusaiteja

Copy link
Copy Markdown

The asset state store only offers synchronous get/set/delete/clear. These block the event loop on every supervisor round-trip, which stalls other coroutines in async tasks and, for watcher triggers, every other trigger sharing the triggerer loop. The watcher trigger example in the docs was itself calling the blocking accessors inside async def run().

#68232 solved the same problem for the task state store. Instead of the direct async HTTP client path proposed in the issue, it awaits the supervisor round-trip via SUPERVISOR_COMMS.asend(), so nothing blocks the loop and no extra client wiring is needed at task startup. This PR extends that pattern to the asset state store:

  • aget/aset/adelete/aclear on AssetStateStoreAccessor and on the single-inlet shorthand of AssetStateStoreAccessors
  • adelete/aclear await the async variants on the custom backend (BaseStoreBackend.adelete/aclear), which already existed
  • message building and response extraction are shared between the sync and async paths, so sync behavior is unchanged
  • docs cover the new async accessors, and the watcher trigger example now uses aget/aset instead of blocking the triggerer loop

With this and #68232, every state store accessor has a non-blocking path. The remaining idea from the issue, bypassing the supervisor with a direct async HTTP client, may not be needed given the asend() approach, so leaving that call to the maintainers.

related: #66842

Was generative AI tooling used to co-author this PR?
  • Yes. Claude Code (Fable 5)

Generated-by: Claude Code (Fable 5) following the guidelines

…ggers

Watcher triggers run on the triggerer's shared event loop and async tasks
on the worker's, but the asset state store only offered synchronous
accessors that block the loop on every supervisor round-trip — stalling
every other trigger or coroutine. Task state store gained async accessors
in apache#68232; this closes the same gap for asset state store.
@kaxil

kaxil commented Oct 1, 2026

Copy link
Copy Markdown
Member

Closing this. #72127 added aget, aset, adelete and aclear to AssetStateStoreAccessor on main, with the same message-building split, and asset-state-store.rst already documents them.

@kaxil kaxil closed this Oct 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants