Skip to content

How to access app_id and partition_key inside an action? #445

Answered by skrawcz
shun-liang asked this question in Help + Q&A
Discussion options

You must be logged in to vote

Yes, you're right this isn't in the docs. We need to add that. You can access it in the action by declaring a __context: ApplicationContext parameter, and then accessing it like so:

from burr.core import action, State, ApplicationContext

@action(reads=["..."], writes=["..."])
def my_action(state: State, __context: ApplicationContext) -> State:
    print(__context.app_id, __context.partition_key, __context.sequence_id)
    ...

See this notebook for example usage.

Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
1 reply
@skrawcz
Comment options

Answer selected by shun-liang
Comment options

You must be logged in to vote
2 replies
@skrawcz
Comment options

@skrawcz
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants