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

3 more Python samples #65

Merged
merged 5 commits into from
Mar 29, 2023
Merged

3 more Python samples #65

merged 5 commits into from
Mar 29, 2023

Conversation

cretz
Copy link
Member

@cretz cretz commented Mar 27, 2023

What was changed

@cretz cretz requested a review from a team March 27, 2023 15:37
Comment on lines +13 to +14
parser.add_argument("--start-workflow", help="Start workflow with this ID")
parser.add_argument("--query-workflow", help="Query workflow with this ID")
Copy link
Member

Choose a reason for hiding this comment

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

nit: I'd make these subcommands:
https://docs.python.org/3/library/argparse.html#sub-commands

I'd also encourage using a nicer argument parser like click for samples where we don't care too much about the additional dependency.

Copy link
Member Author

Choose a reason for hiding this comment

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

I would rather not add a dependency and I intentionally didn't use subcommands just in case someone wanted to run both themselves

@@ -0,0 +1,97 @@
# Patching Sample

This sample shows how to safely alter a workflow using `patched` and `deprecate_patch` in stages.
Copy link
Member

Choose a reason for hiding this comment

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

Why did you choose this workflow as the sample for patches?
It's not especially practical and doesn't show how patches help making workflow changes that would otherwise break determinism, changing a query result can be done without patching.

Copy link
Member Author

@cretz cretz Mar 27, 2023

Choose a reason for hiding this comment

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

I didn't really choose any particular one, I just wanted to focus on the patch part without creating activities or timers. I am afraid, as has happened with other samples, that people focus on the wrong part if I add extra things. In this case, you're trying to focus on what is being patched instead of the patch itself, which I guarantee means if I do then the user will as well which is what I'm trying to avoid.

Copy link
Member Author

Choose a reason for hiding this comment

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

I have updated the sample to use activities instead. I was gonna demonstrate the non-determinism in README, but I can't until I upgrade Python to a core version with temporalio/sdk-core#475.

@cretz cretz merged commit 4a602ff into temporalio:main Mar 29, 2023
@cretz cretz deleted the more-samples branch March 29, 2023 19:13
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.

Sample request: Patching Sample request: Prometheus Sample request: Activities as instance methods
2 participants