Skip to content

Commit d5518da

Browse files
Keeps same api
Signed-off-by: Elena Kolevska <[email protected]>
1 parent f768d28 commit d5518da

File tree

3 files changed

+9
-6
lines changed

3 files changed

+9
-6
lines changed

dapr/aio/clients/grpc/client.py

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

15021502
try:
15031503
resp = self._stub.GetWorkflowBeta1(req)
1504+
# not found workflows return no error, but empty status
1505+
if resp.runtime_status == '':
1506+
raise DaprInternalError('no such instance exists')
15041507
if resp.created_at is None:
15051508
resp.created_at = datetime.now
15061509
if resp.last_updated_at is None:

dapr/clients/grpc/client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1504,7 +1504,7 @@ def get_workflow(self, instance_id: str, workflow_component: str) -> GetWorkflow
15041504
resp = self.retry_policy.run_rpc(self._stub.GetWorkflowBeta1, req)
15051505
# not found workflows return no error, but empty status
15061506
if resp.runtime_status == '':
1507-
return None
1507+
raise DaprInternalError('no such instance exists')
15081508
if resp.created_at is None:
15091509
resp.created_at = datetime.now()
15101510
if resp.last_updated_at is None:

examples/demo_workflow/app.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -205,11 +205,11 @@ def main():
205205
# Purge Test
206206
d.purge_workflow(instance_id=instance_id, workflow_component=workflow_component)
207207
sleep(5)
208-
get_response = d.get_workflow(
209-
instance_id=instance_id, workflow_component=workflow_component
210-
)
211-
if get_response is None:
212-
print('Instance Successfully Purged')
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')
213213

214214
workflow_runtime.shutdown()
215215

0 commit comments

Comments
 (0)