@@ -304,20 +304,36 @@ The Client project:
304
304
- Uses standard logging to show progress and results
305
305
306
306
``` python
307
- # Schedule a new orchestration instance
308
- instance_id = client.schedule_new_orchestration(
309
- " function_chaining_orchestrator" ,
310
- input = name
311
- )
312
-
313
- logger.info(f " Started orchestration with ID = { instance_id} " )
314
-
315
- # Wait for orchestration to complete
316
- logger.info(" Waiting for orchestration to complete..." )
317
- result = client.wait_for_orchestration_completion(
318
- instance_id,
319
- timeout = 30
320
- )
307
+ # Schedule all orchestrations first
308
+ instance_ids = []
309
+ for i in range (TOTAL_ORCHESTRATIONS ):
310
+ try :
311
+ # Create a unique instance name
312
+ instance_name = f " { name} _ { i+ 1 } "
313
+ logger.info(f " Scheduling orchestration # { i+ 1 } ( { instance_name} ) " )
314
+
315
+ # Schedule the orchestration
316
+ instance_id = client.schedule_new_orchestration(
317
+ " function_chaining_orchestrator" ,
318
+ input = instance_name
319
+ )
320
+
321
+ instance_ids.append(instance_id)
322
+ logger.info(f " Orchestration # { i+ 1 } scheduled with ID: { instance_id} " )
323
+
324
+ # Wait before scheduling next orchestration (except for the last one)
325
+ if i < TOTAL_ORCHESTRATIONS - 1 :
326
+ logger.info(f " Waiting { INTERVAL_SECONDS } seconds before scheduling next orchestration... " )
327
+ await asyncio.sleep(INTERVAL_SECONDS )
328
+ # ...
329
+ # Wait for all orchestrations to complete
330
+ for idx, instance_id in enumerate (instance_ids):
331
+ try :
332
+ logger.info(f " Waiting for orchestration { idx+ 1 } / { len (instance_ids)} (ID: { instance_id} )... " )
333
+ result = client.wait_for_orchestration_completion(
334
+ instance_id,
335
+ timeout = 120
336
+ )
321
337
```
322
338
323
339
### Worker
0 commit comments