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

Multi-run support for workflow #935

Merged
merged 10 commits into from
Sep 27, 2023
Merged
6 changes: 6 additions & 0 deletions .github/holopin.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
organization: dapr
defaultSticker: clmjkxscc122740fl0mkmb7egi
stickers:
-
id: clmjkxscc122740fl0mkmb7egi
alias: ghc2023
1 change: 1 addition & 0 deletions .github/workflows/validate_python_quicstarts.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ jobs:
echo "PATH=$PATH:$HOME/.local/bin" >> $GITHUB_ENV
pip3 install setuptools wheel
pip3 install mechanical-markdown
pip3 install fastapi uvicorn
- name: Validate building blocks with Python
run: |
variants=("http" "sdk")
Expand Down
107 changes: 58 additions & 49 deletions pub_sub/csharp/http/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,78 +14,87 @@ And one subscriber:

- Dotnet subscriber `order-processor`

### Run Dotnet message subscriber with Dapr
## Run all apps with multi-app run template file:

1. Navigate to the directory and install dependencies:
This section shows how to run both applications at once using [multi-app run template files](https://docs.dapr.io/developing-applications/local-development/multi-app-dapr-run/multi-app-overview/) with `dapr run -f .`. This enables to you test the interactions between multiple applications.

<!-- STEP
name: Install Dotnet dependencies
-->

```bash
cd ./order-processor
dotnet restore
dotnet build
```
<!-- END_STEP -->
2. Run the Dotnet subscriber app with Dapr:
1. Open a new terminal window and run `order-processor` and `checkout` using the multi app run template defined in [dapr.yaml](./dapr.yaml):

<!-- STEP
name: Run Dotnet subscriber
name: Run multi app run template
expected_stdout_lines:
- "You're up and running! Both Dapr and your app logs will appear here."
- '== APP == Subscriber received : 2'
- "Exited Dapr successfully"
- "Exited App successfully"
- 'Started Dapr with app id "order-processor-http"'
- 'Started Dapr with app id "checkout-http"'
- '== APP - checkout-http == Published data: Order { OrderId = 2 }'
- '== APP - order-processor-http == Subscriber received : 2'
expected_stderr_lines:
working_dir: ./order-processor
output_match_mode: substring
match_order: none
background: true
sleep: 10
sleep: 15
timeout_seconds: 45
-->


```bash
dapr run --app-id order-processor-http --resources-path ../../../components/ --app-port 7005 -- dotnet run --project .
dapr run -f .
```

The terminal console output should look similar to this:

```text
== APP - checkout-http == Published data: Order { OrderId = 1 }
== APP - order-processor-http == Subscriber received : 1
== APP - checkout-http == Published data: Order { OrderId = 2 }
== APP - order-processor-http == Subscriber received : 2
== APP - checkout-http == Published data: Order { OrderId = 3 }
== APP - order-processor-http == Subscriber received : 3
== APP - checkout-http == Published data: Order { OrderId = 4 }
== APP - order-processor-http == Subscriber received : 4
== APP - checkout-http == Published data: Order { OrderId = 5 }
== APP - order-processor-http == Subscriber received : 5
== APP - checkout-http == Published data: Order { OrderId = 6 }
== APP - order-processor-http == Subscriber received : 6
== APP - checkout-http == Published data: Order { OrderId = 7 }
== APP - order-processor-http == Subscriber received : 7
== APP - checkout-http == Published data: Order { OrderId = 8 }
== APP - order-processor-http == Subscriber received : 8
== APP - checkout-http == Published data: Order { OrderId = 9 }
== APP - order-processor-http == Subscriber received : 9
== APP - checkout-http == Published data: Order { OrderId = 10 }
== APP - order-processor-http == Subscriber received : 10
```

2. Stop and clean up application processes

```bash
dapr stop -f .
```
<!-- END_STEP -->
### Run Dotnet message publisher with Dapr

1. Navigate to the directory and install dependencies:
## Run a single app at a time with Dapr (Optional)

<!-- STEP
name: Install Dotnet dependencies
-->
An alternative to running all or multiple applications at once is to run single apps one-at-a-time using multiple `dapr run .. -- dotnet run` commands. This next section covers how to do this.

### Run Dotnet message subscriber with Dapr

1. Run the Dotnet subscriber app with Dapr:

```bash
cd ./checkout
dotnet restore
dotnet build
cd ./order-processor
dapr run --app-id order-processor-http --resources-path ../../../components/ --app-port 7005 -- dotnet run
```
<!-- END_STEP -->
2. Run the Dotnet publisher app with Dapr:

<!-- STEP
name: Run Dotnet publisher
expected_stdout_lines:
- "You're up and running! Both Dapr and your app logs will appear here."
- '== APP == Published data: Order { OrderId = 1 }'
- '== APP == Published data: Order { OrderId = 2 }'
- "Exited App successfully"
- "Exited Dapr successfully"
expected_stderr_lines:
working_dir: ./checkout
output_match_mode: substring
background: true
sleep: 10
-->

### Run Dotnet message publisher with Dapr

1. Run the Dotnet publisher app with Dapr:


```bash
dapr run --app-id checkout-http --resources-path ../../../components/ -- dotnet run --project .
cd ./checkout
dapr run --app-id checkout-http --resources-path ../../../components/ -- dotnet run
```

<!-- END_STEP -->
2. Stop and clean up application processes

```bash
dapr stop --app-id order-processor-http
Expand Down
11 changes: 11 additions & 0 deletions pub_sub/csharp/http/dapr.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
version: 1
common:
resourcesPath: ../../components/
apps:
- appID: order-processor-http
appDirPath: ./order-processor/
appPort: 7005
command: ["dotnet", "run"]
- appID: checkout-http
appDirPath: ./checkout/
command: ["dotnet", "run"]
107 changes: 58 additions & 49 deletions pub_sub/csharp/sdk/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,78 +14,87 @@ And one subscriber:

- Dotnet subscriber `order-processor`

### Run Dotnet message subscriber with Dapr
## Run all apps with multi-app run template file:

1. Navigate to the directory and install dependencies:
This section shows how to run both applications at once using [multi-app run template files](https://docs.dapr.io/developing-applications/local-development/multi-app-dapr-run/multi-app-overview/) with `dapr run -f .`. This enables to you test the interactions between multiple applications.

<!-- STEP
name: Install Dotnet dependencies
-->

```bash
cd ./order-processor
dotnet restore
dotnet build
```
<!-- END_STEP -->
2. Run the Dotnet subscriber app with Dapr:
1. Open a new terminal window and run the multi app run template:

<!-- STEP
name: Run Dotnet subscriber
name: Run multi app run template
expected_stdout_lines:
- "You're up and running! Both Dapr and your app logs will appear here."
- '== APP == Subscriber received : Order { OrderId = 2 }'
- "Exited Dapr successfully"
- "Exited App successfully"
- 'Started Dapr with app id "order-processor"'
- 'Started Dapr with app id "checkout-sdk"'
- 'Published data: Order { OrderId = 2 }'
- 'Subscriber received : Order { OrderId = 2 }'
expected_stderr_lines:
working_dir: ./order-processor
output_match_mode: substring
match_order: none
background: true
sleep: 10
sleep: 15
timeout_seconds: 60
-->


```bash
dapr run --app-id order-processor --resources-path ../../../components/ --app-port 7006 -- dotnet run --project .
dapr run -f .
```

The terminal console output should look similar to this:

```text
== APP - checkout-sdk == Published data: Order { OrderId = 1 }
== APP - order-processor == Subscriber received : Order { OrderId = 1 }
== APP - checkout-sdk == Published data: Order { OrderId = 2 }
== APP - order-processor == Subscriber received : Order { OrderId = 2 }
== APP - checkout-sdk == Published data: Order { OrderId = 3 }
== APP - order-processor == Subscriber received : Order { OrderId = 3 }
== APP - checkout-sdk == Published data: Order { OrderId = 4 }
== APP - order-processor == Subscriber received : Order { OrderId = 4 }
== APP - checkout-sdk == Published data: Order { OrderId = 5 }
== APP - order-processor == Subscriber received : Order { OrderId = 5 }
== APP - checkout-sdk == Published data: Order { OrderId = 6 }
== APP - order-processor == Subscriber received : Order { OrderId = 6 }
== APP - checkout-sdk == Published data: Order { OrderId = 7 }
== APP - order-processor == Subscriber received : Order { OrderId = 7 }
== APP - checkout-sdk == Published data: Order { OrderId = 8 }
== APP - order-processor == Subscriber received : Order { OrderId = 8 }
== APP - checkout-sdk == Published data: Order { OrderId = 9 }
== APP - order-processor == Subscriber received : Order { OrderId = 9 }
== APP - checkout-sdk == Published data: Order { OrderId = 10 }
== APP - order-processor == Subscriber received : Order { OrderId = 10 }
```

2. Stop and clean up application processes

```bash
dapr stop -f .
```
<!-- END_STEP -->
### Run Dotnet message publisher with Dapr

1. Navigate to the directory and install dependencies:
## Run a single app at a time with Dapr (Optional)

<!-- STEP
name: Install Dotnet dependencies
-->
An alternative to running all or multiple applications at once is to run single apps one-at-a-time using multiple `dapr run .. -- dotnet run` commands. This next section covers how to do this.

### Run Dotnet message subscriber with Dapr

1. Run the Dotnet subscriber app with Dapr:

```bash
cd ./checkout
dotnet restore
dotnet build
cd ./order-processor
dapr run --app-id order-processor --resources-path ../../../components/ --app-port 7006 -- dotnet run
```
<!-- END_STEP -->
2. Run the Dotnet publisher app with Dapr:

<!-- STEP
name: Run Dotnet publisher
expected_stdout_lines:
- "You're up and running! Both Dapr and your app logs will appear here."
- '== APP == Published data: Order { OrderId = 1 }'
- '== APP == Published data: Order { OrderId = 2 }'
- "Exited App successfully"
- "Exited Dapr successfully"
expected_stderr_lines:
working_dir: ./checkout
output_match_mode: substring
background: true
sleep: 10
-->

### Run Dotnet message publisher with Dapr

1. Run the Dotnet publisher app with Dapr:


```bash
dapr run --app-id checkout-sdk --resources-path ../../../components/ -- dotnet run --project .
cd ./checkout
dapr run --app-id checkout-sdk --resources-path ../../../components/ -- dotnet run
```

<!-- END_STEP -->
2. Stop and clean up application processes

```bash
dapr stop --app-id order-processor
Expand Down
11 changes: 11 additions & 0 deletions pub_sub/csharp/sdk/dapr.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
version: 1
common:
resourcesPath: ../../components/
apps:
- appID: order-processor
appDirPath: ./order-processor/
appPort: 7006
command: ["dotnet", "run"]
- appID: checkout-sdk
appDirPath: ./checkout/
command: ["dotnet", "run"]
Loading
Loading