Skip to content

Commit 0dde629

Browse files
Merge pull request #2 from acroca/updates-protos
Fix legacy demo_workflow example
2 parents 5003c1f + 1a57bd8 commit 0dde629

File tree

3 files changed

+9
-8
lines changed

3 files changed

+9
-8
lines changed

dapr/clients/grpc/client.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1502,6 +1502,9 @@ def get_workflow(self, instance_id: str, workflow_component: str) -> GetWorkflow
15021502

15031503
try:
15041504
resp = self.retry_policy.run_rpc(self._stub.GetWorkflowBeta1, req)
1505+
# not found workflows return no error, but empty status
1506+
if resp.runtime_status == "":
1507+
return None
15051508
if resp.created_at is None:
15061509
resp.created_at = datetime.now()
15071510
if resp.last_updated_at is None:

examples/demo_workflow/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,11 @@ expected_stdout_lines:
4949
- "== APP == Get response from hello_world_wf after resume call: Running"
5050
- "== APP == New counter value is: 111!"
5151
- "== APP == New counter value is: 1111!"
52-
- "== APP == Instance Successfully Purged"
5352
- "== APP == Get response from hello_world_wf after terminate call: Terminated"
5453
- "== APP == Get response from child_wf after terminate call: Terminated"
54+
- "== APP == Instance Successfully Purged"
5555
background: true
56-
timeout_seconds: 30
56+
timeout_seconds: 50
5757
sleep: 15
5858
-->
5959

@@ -83,7 +83,7 @@ You should be able to see the following output:
8383
== APP == Get response from hello_world_wf after resume call: Running
8484
== APP == New counter value is: 111!
8585
== APP == New counter value is: 1111!
86-
== APP == Instance Successfully Purged
8786
== APP == Get response from hello_world_wf after terminate call: Terminated
8887
== APP == Get response from child_wf after terminate call: Terminated
88+
== APP == Instance Successfully Purged
8989
```

examples/demo_workflow/app.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -205,11 +205,9 @@ def main():
205205
# Purge Test
206206
d.purge_workflow(instance_id=instance_id, workflow_component=workflow_component)
207207
sleep(5)
208-
try:
209-
d.get_workflow(instance_id=instance_id, workflow_component=workflow_component)
210-
except DaprInternalError as err:
211-
if non_existent_id_error in err._message:
212-
print('Instance Successfully Purged')
208+
get_response = d.get_workflow(instance_id=instance_id, workflow_component=workflow_component)
209+
if get_response is None:
210+
print('Instance Successfully Purged')
213211

214212
workflow_runtime.shutdown()
215213

0 commit comments

Comments
 (0)