How to access app_id and partition_key inside an action?
#445
Answered
by
skrawcz
shun-liang
asked this question in
Help + Q&A
|
Dear burr developers Sorry if it's obivous, but in the documentation I haven't found any information about how to access |
Answered by
skrawcz
Dec 2, 2024
Replies: 2 comments 3 replies
|
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 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)
... |
1 reply
Answer selected by
shun-liang
|
Thanks for the answer @skrawcz . Can you please also add an example achieving the same but with a class-based action? |
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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: ApplicationContextparameter, and then accessing it like so:See this notebook for example usage.