Skip to content

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

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

Merged
merged 3 commits into from
Jan 24, 2025

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 4 times, most recently from 16fe7ee to 47c3114 Compare January 23, 2025 22:51
@dandavison dandavison force-pushed the 720-workflow-instance branch from 47c3114 to 87e80fe Compare January 23, 2025 23:14
@dandavison dandavison merged commit 044b1de into main Jan 24, 2025
14 checks passed
@dandavison dandavison deleted the 720-workflow-instance branch January 24, 2025 14:12
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