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

Update-with-start: shopping cart #156

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

Update-with-start: shopping cart #156

wants to merge 10 commits into from

Conversation

dandavison
Copy link
Contributor

@dandavison dandavison commented Dec 12, 2024

  • The Workflow represents a Shopping Cart in an e-commerce application, and
    update-with-start is used to add items to the cart, receiving back the updated cart subtotal.

  • Cannot be merged until UwS is released

@dandavison dandavison marked this pull request as ready for review December 20, 2024 14:09
README.md Outdated Show resolved Hide resolved

@workflow.signal
def checkout(self):
self.order_submitted = True
Copy link
Member

Choose a reason for hiding this comment

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

Hrmm, I wonder if we should add a validator that disallows add_item if this is true. While this workflow is safe and doesn't need it, it could be a good demo, and would help users if they ever had a step between the wait condition and the return.

Comment on lines +8 to +11
from message_passing.update_with_start.lazy_initialization.activities import (
ShoppingCartItem,
get_price,
)
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
from message_passing.update_with_start.lazy_initialization.activities import (
ShoppingCartItem,
get_price,
)
with workflow.unsafe.imports_passed_through():
from message_passing.update_with_start.lazy_initialization.activities import (
ShoppingCartItem,
get_price,
)

Need to encourage passing through all activity references and externally defined models instead of reloading them every workflow (for the samples this technically works because the activity doesn't do anything externally meaningful)

dandavison and others added 2 commits December 20, 2024 11:52
Co-authored-by: Chad Retz <[email protected]>
Co-authored-by: Chad Retz <[email protected]>
@@ -0,0 +1,16 @@
# Update With Start: Lazy init
Copy link

Choose a reason for hiding this comment

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

Can you add a little blurb as to what "lazy init" means here? Does lazy init here refer to how we're using update_with_start to initialize and start the workflow?

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.

3 participants