Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add workflow.instance() API for obtaining current workflow instance #739

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

dandavison
Copy link
Contributor

Fixes #720

@dandavison dandavison requested a review from a team as a code owner January 18, 2025 03:46
@dandavison dandavison force-pushed the 720-workflow-instance branch 2 times, most recently from 2485f19 to 5d752a6 Compare January 18, 2025 22:48


class WorkflowInstanceAccessInboundInterceptor(WorkflowInboundInterceptor):
async def execute_workflow(self, input: ExecuteWorkflowInput) -> int:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you confirm that the workflow.instance() is non-None when this interceptor starts? I read through the code and I suspect it is, just wanted to confirm.

Copy link
Contributor Author

@dandavison dandavison Jan 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this do what you're suggesting? 0b8a0bd

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, thanks!

@Quinn-With-Two-Ns
Copy link

What about the activity instance? Will that be a separate issue?

@cretz
Copy link
Member

cretz commented Jan 21, 2025

What about the activity instance? Will that be a separate issue?

For activity instance, it's not needed in Python because we don't ever create the instance, only the user does. And we only need to provide the instance in cases where we create it and control the lifetime.

@dandavison dandavison force-pushed the 720-workflow-instance branch from 5d752a6 to 306b050 Compare January 21, 2025 22:51
@dandavison dandavison force-pushed the 720-workflow-instance branch from 306b050 to 49be3d1 Compare January 23, 2025 13:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature Request] Access to workflow instance from context
3 participants