@@ -175,6 +175,34 @@ def parent_orchestrator(ctx: task.OrchestrationContext, count: int):
175175 assert activity_counter == 30
176176
177177
178+ def test_sub_orchestrator_by_name ():
179+ sub_orchestrator_counter = 0
180+
181+ def orchestrator_child (ctx : task .OrchestrationContext , _ ):
182+ nonlocal sub_orchestrator_counter
183+ sub_orchestrator_counter += 1
184+
185+ def parent_orchestrator (ctx : task .OrchestrationContext , _ ):
186+ yield ctx .call_sub_orchestrator ("orchestrator_child" )
187+
188+ # Start a worker, which will connect to the sidecar in a background thread
189+ with DurableTaskSchedulerWorker (host_address = endpoint , secure_channel = True ,
190+ taskhub = taskhub_name , token_credential = None ) as w :
191+ w .add_orchestrator (orchestrator_child )
192+ w .add_orchestrator (parent_orchestrator )
193+ w .start ()
194+
195+ task_hub_client = DurableTaskSchedulerClient (host_address = endpoint , secure_channel = True ,
196+ taskhub = taskhub_name , token_credential = None )
197+ id = task_hub_client .schedule_new_orchestration (parent_orchestrator , input = None )
198+ state = task_hub_client .wait_for_orchestration_completion (id , timeout = 30 )
199+
200+ assert state is not None
201+ assert state .runtime_status == client .OrchestrationStatus .COMPLETED
202+ assert state .failure_details is None
203+ assert sub_orchestrator_counter == 1
204+
205+
178206def test_wait_for_multiple_external_events ():
179207 def orchestrator (ctx : task .OrchestrationContext , _ ):
180208 a = yield ctx .wait_for_external_event ('A' )
0 commit comments