@@ -316,6 +316,7 @@ async def start_workflow(
316
316
start_delay : Optional [timedelta ] = None ,
317
317
start_signal : Optional [str ] = None ,
318
318
start_signal_args : Sequence [Any ] = [],
319
+ completion_callbacks : Sequence [temporalio .common .CompletionCallback ] = [],
319
320
rpc_metadata : Mapping [str , str ] = {},
320
321
rpc_timeout : Optional [timedelta ] = None ,
321
322
request_eager_start : bool = False ,
@@ -350,6 +351,7 @@ async def start_workflow(
350
351
start_delay : Optional [timedelta ] = None ,
351
352
start_signal : Optional [str ] = None ,
352
353
start_signal_args : Sequence [Any ] = [],
354
+ completion_callbacks : Sequence [temporalio .common .CompletionCallback ] = [],
353
355
rpc_metadata : Mapping [str , str ] = {},
354
356
rpc_timeout : Optional [timedelta ] = None ,
355
357
request_eager_start : bool = False ,
@@ -386,6 +388,7 @@ async def start_workflow(
386
388
start_delay : Optional [timedelta ] = None ,
387
389
start_signal : Optional [str ] = None ,
388
390
start_signal_args : Sequence [Any ] = [],
391
+ completion_callbacks : Sequence [temporalio .common .CompletionCallback ] = [],
389
392
rpc_metadata : Mapping [str , str ] = {},
390
393
rpc_timeout : Optional [timedelta ] = None ,
391
394
request_eager_start : bool = False ,
@@ -422,6 +425,7 @@ async def start_workflow(
422
425
start_delay : Optional [timedelta ] = None ,
423
426
start_signal : Optional [str ] = None ,
424
427
start_signal_args : Sequence [Any ] = [],
428
+ completion_callbacks : Sequence [temporalio .common .CompletionCallback ] = [],
425
429
rpc_metadata : Mapping [str , str ] = {},
426
430
rpc_timeout : Optional [timedelta ] = None ,
427
431
request_eager_start : bool = False ,
@@ -456,6 +460,7 @@ async def start_workflow(
456
460
start_delay : Optional [timedelta ] = None ,
457
461
start_signal : Optional [str ] = None ,
458
462
start_signal_args : Sequence [Any ] = [],
463
+ completion_callbacks : Sequence [temporalio .common .CompletionCallback ] = [],
459
464
rpc_metadata : Mapping [str , str ] = {},
460
465
rpc_timeout : Optional [timedelta ] = None ,
461
466
request_eager_start : bool = False ,
@@ -500,6 +505,8 @@ async def start_workflow(
500
505
instead of traditional workflow start.
501
506
start_signal_args: Arguments for start_signal if start_signal
502
507
present.
508
+ completion_callbacks: Callbacks to be called by the server when the workflow reaches a
509
+ terminal state.
503
510
rpc_metadata: Headers used on the RPC call. Keys here override
504
511
client-level RPC metadata keys.
505
512
rpc_timeout: Optional RPC deadline to set for the RPC call.
@@ -544,6 +551,7 @@ async def start_workflow(
544
551
static_details = static_details ,
545
552
start_signal = start_signal ,
546
553
start_signal_args = start_signal_args ,
554
+ completion_callbacks = completion_callbacks ,
547
555
ret_type = result_type or result_type_from_type_hint ,
548
556
rpc_metadata = rpc_metadata ,
549
557
rpc_timeout = rpc_timeout ,
@@ -579,6 +587,7 @@ async def execute_workflow(
579
587
start_delay : Optional [timedelta ] = None ,
580
588
start_signal : Optional [str ] = None ,
581
589
start_signal_args : Sequence [Any ] = [],
590
+ completion_callbacks : Sequence [temporalio .common .CompletionCallback ] = [],
582
591
rpc_metadata : Mapping [str , str ] = {},
583
592
rpc_timeout : Optional [timedelta ] = None ,
584
593
request_eager_start : bool = False ,
@@ -613,6 +622,7 @@ async def execute_workflow(
613
622
start_delay : Optional [timedelta ] = None ,
614
623
start_signal : Optional [str ] = None ,
615
624
start_signal_args : Sequence [Any ] = [],
625
+ completion_callbacks : Sequence [temporalio .common .CompletionCallback ] = [],
616
626
rpc_metadata : Mapping [str , str ] = {},
617
627
rpc_timeout : Optional [timedelta ] = None ,
618
628
request_eager_start : bool = False ,
@@ -649,6 +659,7 @@ async def execute_workflow(
649
659
start_delay : Optional [timedelta ] = None ,
650
660
start_signal : Optional [str ] = None ,
651
661
start_signal_args : Sequence [Any ] = [],
662
+ completion_callbacks : Sequence [temporalio .common .CompletionCallback ] = [],
652
663
rpc_metadata : Mapping [str , str ] = {},
653
664
rpc_timeout : Optional [timedelta ] = None ,
654
665
request_eager_start : bool = False ,
@@ -685,6 +696,7 @@ async def execute_workflow(
685
696
start_delay : Optional [timedelta ] = None ,
686
697
start_signal : Optional [str ] = None ,
687
698
start_signal_args : Sequence [Any ] = [],
699
+ completion_callbacks : Sequence [temporalio .common .CompletionCallback ] = [],
688
700
rpc_metadata : Mapping [str , str ] = {},
689
701
rpc_timeout : Optional [timedelta ] = None ,
690
702
request_eager_start : bool = False ,
@@ -719,6 +731,7 @@ async def execute_workflow(
719
731
start_delay : Optional [timedelta ] = None ,
720
732
start_signal : Optional [str ] = None ,
721
733
start_signal_args : Sequence [Any ] = [],
734
+ completion_callbacks : Sequence [temporalio .common .CompletionCallback ] = [],
722
735
rpc_metadata : Mapping [str , str ] = {},
723
736
rpc_timeout : Optional [timedelta ] = None ,
724
737
request_eager_start : bool = False ,
@@ -753,6 +766,7 @@ async def execute_workflow(
753
766
start_delay = start_delay ,
754
767
start_signal = start_signal ,
755
768
start_signal_args = start_signal_args ,
769
+ completion_callbacks = completion_callbacks ,
756
770
rpc_metadata = rpc_metadata ,
757
771
rpc_timeout = rpc_timeout ,
758
772
request_eager_start = request_eager_start ,
@@ -5148,6 +5162,7 @@ class StartWorkflowInput:
5148
5162
headers : Mapping [str , temporalio .api .common .v1 .Payload ]
5149
5163
start_signal : Optional [str ]
5150
5164
start_signal_args : Sequence [Any ]
5165
+ completion_callbacks : Sequence [temporalio .common .CompletionCallback ]
5151
5166
static_summary : Optional [str ]
5152
5167
static_details : Optional [str ]
5153
5168
# Type may be absent
@@ -5770,6 +5785,11 @@ async def _build_start_workflow_execution_request(
5770
5785
req = temporalio .api .workflowservice .v1 .StartWorkflowExecutionRequest ()
5771
5786
req .request_eager_execution = input .request_eager_start
5772
5787
await self ._populate_start_workflow_execution_request (req , input )
5788
+ for callback in input .completion_callbacks :
5789
+ c = temporalio .api .common .v1 .Callback ()
5790
+ c .nexus .url = callback .url
5791
+ c .nexus .header .update (callback .header )
5792
+ req .completion_callbacks .append (c )
5773
5793
return req
5774
5794
5775
5795
async def _build_signal_with_start_workflow_execution_request (
0 commit comments