Skip to content

Commit

Permalink
Adding multi-app run for python and C#
Browse files Browse the repository at this point in the history
Signed-off-by: Paul Yuknewicz <[email protected]>
  • Loading branch information
Paul Yuknewicz authored and Paul Yuknewicz committed Sep 23, 2023
1 parent 72d0791 commit 0b09f11
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 8 deletions.
17 changes: 12 additions & 5 deletions workflows/python/sdk/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ name: Install requirements
```sh
cd ./order-processor
pip3 install -r requirements.txt
cd ..
```

<!-- END_STEP -->
Expand All @@ -36,17 +37,14 @@ expected_stdout_lines:
- "Purchase of item is Completed"
output_match_mode: substring
background: true
timeout_seconds: 30
timeout_seconds: 240
sleep: 15
-->

```sh
cd ./order-processor
dapr run --app-id order-processor --resources-path ../../../components/ -- python3 app.py
dapr run -f .
```

<!-- END_STEP -->

3. Expected output

```
Expand All @@ -71,6 +69,15 @@ Workflow completed! Result: Completed
Purchase of item is Completed
```

4. Stop Dapr workflow with CTRL-C or:
<!-- END_STEP -->

```sh
dapr stop -f .
```



### View workflow output with Zipkin

For a more detailed view of the workflow activities (duration, progress etc.), try using Zipkin.
Expand Down
7 changes: 7 additions & 0 deletions workflows/python/sdk/dapr.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
version: 1
common:
resourcesPath: ../../components
apps:
- appDirPath: ./order-processor/
appID: order-processor
command: ["python3", "app.py"]
4 changes: 2 additions & 2 deletions workflows/python/sdk/order-processor/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
verify_inventory_activity, update_inventory_activity, requst_approval_activity
from model import InventoryItem, OrderPayload

store_name = "statestore-actors"
store_name = "statestore"
workflow_component = "dapr"
workflow_name = "order_processing_workflow"
default_item_name = "cars"
Expand Down Expand Up @@ -108,7 +108,7 @@ def restock_inventory(self, daprClient: DaprClient, baseInventory):
print(f'item: {item}')
item_str = f'{{"name": "{item.item_name}", "quantity": {item.quantity},\
"per_item_cost": {item.per_item_cost}}}'
daprClient.save_state("statestore-actors", key, item_str)
daprClient.save_state(store_name, key, item_str)

if __name__ == '__main__':
app = WorkflowConsoleApp()
Expand Down
2 changes: 1 addition & 1 deletion workflows/python/sdk/order-processor/workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from model import InventoryItem, Notification, InventoryRequest, OrderPayload, OrderResult,\
PaymentRequest, InventoryResult

store_name = "statestore-actors"
store_name = "statestore"

logging.basicConfig(level=logging.INFO)

Expand Down

0 comments on commit 0b09f11

Please sign in to comment.