@@ -70,13 +70,13 @@ def is_replaying(self) -> bool:
7070 pass
7171
7272 @abstractmethod
73- def set_custom_status (self , custom_status : Any ) -> None :
73+ def set_custom_status (self , custom_status : str ) -> None :
7474 """Set the orchestration instance's custom status.
7575
7676 Parameters
7777 ----------
78- custom_status: Any
79- A JSON-serializable custom status value to set.
78+ custom_status: str
79+ A custom status string to set.
8080 """
8181 pass
8282
@@ -396,16 +396,24 @@ class RetryableTask(CompletableTask[T]):
396396 def __init__ (
397397 self ,
398398 retry_policy : RetryPolicy ,
399- action : pb .OrchestratorAction ,
400399 start_time : datetime ,
401400 is_sub_orch : bool ,
401+ task_name : str ,
402+ encoded_input : Optional [str ] = None ,
403+ task_execution_id : str = "" ,
404+ instance_id : Optional [str ] = None ,
405+ app_id : Optional [str ] = None ,
402406 ) -> None :
403407 super ().__init__ ()
404- self ._action = action
405408 self ._retry_policy = retry_policy
406409 self ._attempt_count = 1
407410 self ._start_time = start_time
408411 self ._is_sub_orch = is_sub_orch
412+ self ._task_name = task_name
413+ self ._encoded_input = encoded_input
414+ self ._task_execution_id = task_execution_id
415+ self ._instance_id = instance_id
416+ self ._app_id = app_id
409417
410418 def increment_attempt_count (self ) -> None :
411419 self ._attempt_count += 1
@@ -479,9 +487,10 @@ def when_any(tasks: list[Task]) -> WhenAnyTask:
479487
480488
481489class ActivityContext :
482- def __init__ (self , orchestration_id : str , task_id : int ):
490+ def __init__ (self , orchestration_id : str , task_id : int , task_execution_id : str = "" ):
483491 self ._orchestration_id = orchestration_id
484492 self ._task_id = task_id
493+ self ._task_execution_id = task_execution_id
485494
486495 @property
487496 def orchestration_id (self ) -> str :
@@ -510,6 +519,21 @@ def task_id(self) -> int:
510519 """
511520 return self ._task_id
512521
522+ @property
523+ def task_execution_id (self ) -> str :
524+ """Get the task execution ID associated with this activity invocation.
525+
526+ The task execution ID is a UUID that is stable across retry attempts
527+ of the same activity call. It can be used for idempotency and
528+ deduplication when an activity may be retried.
529+
530+ Returns
531+ -------
532+ str
533+ The task execution ID for this activity invocation.
534+ """
535+ return self ._task_execution_id
536+
513537
514538# Orchestrators are generators that yield tasks and receive/return any type
515539Orchestrator = Callable [[OrchestrationContext , TInput ], Union [Generator [Task , Any , Any ], TOutput ]]
0 commit comments