diff --git a/README.md b/README.md index 5cffefce..63ebeda9 100644 --- a/README.md +++ b/README.md @@ -71,6 +71,7 @@ Some examples require extra dependencies. See each sample's directory for specif * [safe_message_handlers](message_passing/safe_message_handlers/) - Safely handling updates and signals. * [schedules](schedules) - Demonstrates a Workflow Execution that occurs according to a schedule. * [sentry](sentry) - Report errors to Sentry. +* [update_with_start/lazy_init](update_with_start/lazy_init) - Use update-with-start to update a Shopping Cart, starting if it it does not exist. * [worker_specific_task_queues](worker_specific_task_queues) - Use unique task queues to ensure activities run on specific workers. * [worker_versioning](worker_versioning) - Use the Worker Versioning feature to more easily version your workflows & other code. diff --git a/message_passing/update_shopping_cart/README.md b/message_passing/update_with_start/lazy_init/README.md similarity index 94% rename from message_passing/update_shopping_cart/README.md rename to message_passing/update_with_start/lazy_init/README.md index df7d9ebc..0c79dfc4 100644 --- a/message_passing/update_shopping_cart/README.md +++ b/message_passing/update_with_start/lazy_init/README.md @@ -1,4 +1,4 @@ -# Update With Start: Shopping Cart +# Update With Start: Lazy init This sample illustrates the use of update-with-start to send Updates to a Workflow, starting the Workflow if it is not running yet. The Workflow represents a Shopping Cart in an e-commerce application, and diff --git a/message_passing/update_shopping_cart/__init__.py b/message_passing/update_with_start/lazy_init/__init__.py similarity index 100% rename from message_passing/update_shopping_cart/__init__.py rename to message_passing/update_with_start/lazy_init/__init__.py diff --git a/message_passing/update_shopping_cart/activities.py b/message_passing/update_with_start/lazy_init/activities.py similarity index 100% rename from message_passing/update_shopping_cart/activities.py rename to message_passing/update_with_start/lazy_init/activities.py diff --git a/message_passing/update_shopping_cart/starter.py b/message_passing/update_with_start/lazy_init/starter.py similarity index 97% rename from message_passing/update_shopping_cart/starter.py rename to message_passing/update_with_start/lazy_init/starter.py index 0546c8aa..d66d3f43 100644 --- a/message_passing/update_shopping_cart/starter.py +++ b/message_passing/update_with_start/lazy_init/starter.py @@ -10,7 +10,7 @@ WorkflowUpdateFailedError, ) -from message_passing.update_shopping_cart.workflows import ( +from message_passing.update_with_start.lazy_init.workflows import ( ShoppingCartItem, ShoppingCartWorkflow, ) diff --git a/message_passing/update_shopping_cart/worker.py b/message_passing/update_with_start/lazy_init/worker.py similarity index 90% rename from message_passing/update_shopping_cart/worker.py rename to message_passing/update_with_start/lazy_init/worker.py index 4eee40a0..c6cc05ad 100644 --- a/message_passing/update_shopping_cart/worker.py +++ b/message_passing/update_with_start/lazy_init/worker.py @@ -4,7 +4,7 @@ from temporalio.client import Client from temporalio.worker import Worker -from message_passing.update_shopping_cart import TASK_QUEUE, workflows +from message_passing.update_with_start.lazy_init import TASK_QUEUE, workflows interrupt_event = asyncio.Event() diff --git a/message_passing/update_shopping_cart/workflows.py b/message_passing/update_with_start/lazy_init/workflows.py similarity index 92% rename from message_passing/update_shopping_cart/workflows.py rename to message_passing/update_with_start/lazy_init/workflows.py index d3a77281..28834e25 100644 --- a/message_passing/update_shopping_cart/workflows.py +++ b/message_passing/update_with_start/lazy_init/workflows.py @@ -5,7 +5,10 @@ from temporalio import workflow from temporalio.exceptions import ApplicationError -from message_passing.update_shopping_cart.activities import ShoppingCartItem, get_price +from message_passing.update_with_start.lazy_init.activities import ( + ShoppingCartItem, + get_price, +) @dataclass