@@ -2883,10 +2883,6 @@ class WorkflowExecution:
28832883 close_time : Optional [datetime ]
28842884 """When the workflow was closed if closed."""
28852885
2886- # WorkflowExecution.data_converter
2887- data_converter : temporalio .converter .DataConverter
2888- """Data converter from when this description was created."""
2889-
28902886 execution_time : Optional [datetime ]
28912887 """When this workflow run started or should start."""
28922888
@@ -2896,6 +2892,9 @@ class WorkflowExecution:
28962892 id : str
28972893 """ID for the workflow."""
28982894
2895+ namespace : str
2896+ """Namespace for the workflow."""
2897+
28992898 parent_id : Optional [str ]
29002899 """ID for the parent workflow if this was started as a child."""
29012900
@@ -2936,10 +2935,22 @@ class WorkflowExecution:
29362935 workflow_type : str
29372936 """Type name for the workflow."""
29382937
2938+ _context_free_data_converter : temporalio .converter .DataConverter
2939+
2940+ @property
2941+ def data_converter (self ) -> temporalio .converter .DataConverter :
2942+ return self ._context_free_data_converter .with_context (
2943+ WorkflowSerializationContext (
2944+ namespace = self .namespace ,
2945+ workflow_id = self .id ,
2946+ )
2947+ )
2948+
29392949 @classmethod
29402950 def _from_raw_info (
29412951 cls ,
29422952 info : temporalio .api .workflow .v1 .WorkflowExecutionInfo ,
2953+ namespace : str ,
29432954 converter : temporalio .converter .DataConverter ,
29442955 ** additional_fields : Any ,
29452956 ) -> WorkflowExecution :
@@ -2949,14 +2960,14 @@ def _from_raw_info(
29492960 if info .HasField ("close_time" )
29502961 else None
29512962 ),
2952- data_converter = converter ,
29532963 execution_time = (
29542964 info .execution_time .ToDatetime ().replace (tzinfo = timezone .utc )
29552965 if info .HasField ("execution_time" )
29562966 else None
29572967 ),
29582968 history_length = info .history_length ,
29592969 id = info .execution .workflow_id ,
2970+ namespace = namespace ,
29602971 parent_id = (
29612972 info .parent_execution .workflow_id
29622973 if info .HasField ("parent_execution" )
@@ -2987,6 +2998,7 @@ def _from_raw_info(
29872998 info .search_attributes
29882999 ),
29893000 workflow_type = info .type .name ,
3001+ _context_free_data_converter = converter ,
29903002 ** additional_fields ,
29913003 )
29923004
@@ -3247,23 +3259,9 @@ async def fetch_next_page(self, *, page_size: Optional[int] = None) -> None:
32473259 timeout = self ._input .rpc_timeout ,
32483260 )
32493261
3250- data_converter_cache = {}
3251-
3252- def get_data_converter (workflow_id : str ) -> temporalio .converter .DataConverter :
3253- if workflow_id not in data_converter_cache :
3254- data_converter_cache [workflow_id ] = (
3255- self ._client .data_converter .with_context (
3256- WorkflowSerializationContext (
3257- namespace = self ._client .namespace ,
3258- workflow_id = workflow_id ,
3259- )
3260- )
3261- )
3262- return data_converter_cache [workflow_id ]
3263-
32643262 self ._current_page = [
32653263 WorkflowExecution ._from_raw_info (
3266- v , get_data_converter ( v . execution . workflow_id )
3264+ v , self . _client . namespace , self . _client . data_converter
32673265 )
32683266 for v in resp .executions
32693267 ]
0 commit comments