diff --git a/examples/workflow/child_workflow.py b/examples/workflow/child_workflow.py index 57ab2fc3..f434e2ea 100644 --- a/examples/workflow/child_workflow.py +++ b/examples/workflow/child_workflow.py @@ -40,12 +40,10 @@ def child_workflow(ctx: wf.DaprWorkflowContext): if __name__ == '__main__': wfr.start() - time.sleep(10) # wait for workflow runtime to start wf_client = wf.DaprWorkflowClient() instance_id = wf_client.schedule_new_workflow(workflow=main_workflow) - # Wait for the workflow to complete - time.sleep(5) + wf_client.wait_for_workflow_completion(instance_id) wfr.shutdown() diff --git a/examples/workflow/cross-app1.py b/examples/workflow/cross-app1.py index 1ef7b48d..69f0c44c 100644 --- a/examples/workflow/cross-app1.py +++ b/examples/workflow/cross-app1.py @@ -46,13 +46,11 @@ def app1_workflow(ctx: wf.DaprWorkflowContext): if __name__ == '__main__': wfr.start() - time.sleep(10) # wait for workflow runtime to start wf_client = wf.DaprWorkflowClient() print('app1 - triggering app1 workflow', flush=True) instance_id = wf_client.schedule_new_workflow(workflow=app1_workflow) - # Wait for the workflow to complete - time.sleep(7) + wf_client.wait_for_workflow_completion(instance_id) wfr.shutdown() diff --git a/examples/workflow/cross-app2.py b/examples/workflow/cross-app2.py index 2af65912..7e97b58c 100644 --- a/examples/workflow/cross-app2.py +++ b/examples/workflow/cross-app2.py @@ -46,5 +46,5 @@ def app2_workflow(ctx: wf.DaprWorkflowContext): if __name__ == '__main__': wfr.start() - time.sleep(15) # wait for workflow runtime to start + time.sleep(15) # Keep the workflow runtime running for a while to process workflows wfr.shutdown() diff --git a/examples/workflow/cross-app3.py b/examples/workflow/cross-app3.py index 4bcc158a..6b72de7e 100644 --- a/examples/workflow/cross-app3.py +++ b/examples/workflow/cross-app3.py @@ -29,5 +29,5 @@ def app3_activity(ctx: wf.DaprWorkflowContext) -> int: if __name__ == '__main__': wfr.start() - time.sleep(15) # wait for workflow runtime to start + time.sleep(15) # Keep the workflow runtime alive for a while to process requests wfr.shutdown() diff --git a/examples/workflow/fan_out_fan_in.py b/examples/workflow/fan_out_fan_in.py index f625ea28..9cd1ff6c 100644 --- a/examples/workflow/fan_out_fan_in.py +++ b/examples/workflow/fan_out_fan_in.py @@ -55,7 +55,6 @@ def process_results(ctx, final_result: int): if __name__ == '__main__': wfr.start() - time.sleep(10) # wait for workflow runtime to start wf_client = wf.DaprWorkflowClient() instance_id = wf_client.schedule_new_workflow(workflow=batch_processing_workflow, input=10)