@@ -206,12 +206,12 @@ async def _handle_activation(
206
206
207
207
# Extract a couple of jobs from the activation
208
208
cache_remove_job = None
209
- start_job = None
209
+ init_job = None
210
210
for job in act .jobs :
211
211
if job .HasField ("remove_from_cache" ):
212
212
cache_remove_job = job .remove_from_cache
213
- elif job .HasField ("start_workflow " ):
214
- start_job = job .start_workflow
213
+ elif job .HasField ("initialize_workflow " ):
214
+ init_job = job .initialize_workflow
215
215
216
216
# Build default success completion (e.g. remove-job-only activations)
217
217
completion = (
@@ -235,16 +235,16 @@ async def _handle_activation(
235
235
if not cache_remove_job or not self ._disable_safe_eviction :
236
236
workflow = self ._running_workflows .get (act .run_id )
237
237
if not workflow and not cache_remove_job :
238
- # Must have a start job to create instance
239
- if not start_job :
238
+ # Must have a initialize job to create instance
239
+ if not init_job :
240
240
raise RuntimeError (
241
- "Missing start workflow, workflow could have unexpectedly been removed from cache"
241
+ "Missing initialize workflow, workflow could have unexpectedly been removed from cache"
242
242
)
243
- workflow = self ._create_workflow_instance (act , start_job )
243
+ workflow = self ._create_workflow_instance (act , init_job )
244
244
self ._running_workflows [act .run_id ] = workflow
245
- elif start_job :
245
+ elif init_job :
246
246
# This should never happen
247
- logger .warn ("Cache already exists for activation with start job" )
247
+ logger .warn ("Cache already exists for activation with initialize job" )
248
248
249
249
# Run activation in separate thread so we can check if it's
250
250
# deadlocked
@@ -354,54 +354,54 @@ async def _handle_activation(
354
354
def _create_workflow_instance (
355
355
self ,
356
356
act : temporalio .bridge .proto .workflow_activation .WorkflowActivation ,
357
- start : temporalio .bridge .proto .workflow_activation .StartWorkflow ,
357
+ init : temporalio .bridge .proto .workflow_activation .InitializeWorkflow ,
358
358
) -> WorkflowInstance :
359
359
# Get the definition
360
- defn = self ._workflows .get (start .workflow_type , self ._dynamic_workflow )
360
+ defn = self ._workflows .get (init .workflow_type , self ._dynamic_workflow )
361
361
if not defn :
362
362
workflow_names = ", " .join (sorted (self ._workflows .keys ()))
363
363
raise temporalio .exceptions .ApplicationError (
364
- f"Workflow class { start .workflow_type } is not registered on this worker, available workflows: { workflow_names } " ,
364
+ f"Workflow class { init .workflow_type } is not registered on this worker, available workflows: { workflow_names } " ,
365
365
type = "NotFoundError" ,
366
366
)
367
367
368
368
# Build info
369
369
parent : Optional [temporalio .workflow .ParentInfo ] = None
370
- if start .HasField ("parent_workflow_info" ):
370
+ if init .HasField ("parent_workflow_info" ):
371
371
parent = temporalio .workflow .ParentInfo (
372
- namespace = start .parent_workflow_info .namespace ,
373
- run_id = start .parent_workflow_info .run_id ,
374
- workflow_id = start .parent_workflow_info .workflow_id ,
372
+ namespace = init .parent_workflow_info .namespace ,
373
+ run_id = init .parent_workflow_info .run_id ,
374
+ workflow_id = init .parent_workflow_info .workflow_id ,
375
375
)
376
376
info = temporalio .workflow .Info (
377
- attempt = start .attempt ,
378
- continued_run_id = start .continued_from_execution_run_id or None ,
379
- cron_schedule = start .cron_schedule or None ,
380
- execution_timeout = start .workflow_execution_timeout .ToTimedelta ()
381
- if start .HasField ("workflow_execution_timeout" )
377
+ attempt = init .attempt ,
378
+ continued_run_id = init .continued_from_execution_run_id or None ,
379
+ cron_schedule = init .cron_schedule or None ,
380
+ execution_timeout = init .workflow_execution_timeout .ToTimedelta ()
381
+ if init .HasField ("workflow_execution_timeout" )
382
382
else None ,
383
- headers = dict (start .headers ),
383
+ headers = dict (init .headers ),
384
384
namespace = self ._namespace ,
385
385
parent = parent ,
386
- raw_memo = dict (start .memo .fields ),
387
- retry_policy = temporalio .common .RetryPolicy .from_proto (start .retry_policy )
388
- if start .HasField ("retry_policy" )
386
+ raw_memo = dict (init .memo .fields ),
387
+ retry_policy = temporalio .common .RetryPolicy .from_proto (init .retry_policy )
388
+ if init .HasField ("retry_policy" )
389
389
else None ,
390
390
run_id = act .run_id ,
391
- run_timeout = start .workflow_run_timeout .ToTimedelta ()
392
- if start .HasField ("workflow_run_timeout" )
391
+ run_timeout = init .workflow_run_timeout .ToTimedelta ()
392
+ if init .HasField ("workflow_run_timeout" )
393
393
else None ,
394
394
search_attributes = temporalio .converter .decode_search_attributes (
395
- start .search_attributes
395
+ init .search_attributes
396
396
),
397
397
start_time = act .timestamp .ToDatetime ().replace (tzinfo = timezone .utc ),
398
398
task_queue = self ._task_queue ,
399
- task_timeout = start .workflow_task_timeout .ToTimedelta (),
399
+ task_timeout = init .workflow_task_timeout .ToTimedelta (),
400
400
typed_search_attributes = temporalio .converter .decode_typed_search_attributes (
401
- start .search_attributes
401
+ init .search_attributes
402
402
),
403
- workflow_id = start .workflow_id ,
404
- workflow_type = start .workflow_type ,
403
+ workflow_id = init .workflow_id ,
404
+ workflow_type = init .workflow_type ,
405
405
)
406
406
407
407
# Create instance from details
@@ -411,7 +411,7 @@ def _create_workflow_instance(
411
411
interceptor_classes = self ._interceptor_classes ,
412
412
defn = defn ,
413
413
info = info ,
414
- randomness_seed = start .randomness_seed ,
414
+ randomness_seed = init .randomness_seed ,
415
415
extern_functions = self ._extern_functions ,
416
416
disable_eager_activity_execution = self ._disable_eager_activity_execution ,
417
417
worker_level_failure_exception_types = self ._workflow_failure_exception_types ,
0 commit comments