@@ -142,23 +142,14 @@ def start_activity(
142142 self , input : worker .StartActivityInput
143143 ) -> workflow .ActivityHandle :
144144 with workflow .unsafe .sandbox_unrestricted ():
145- t = trace (name = f"start_activity:{ input .activity } " , run_id = workflow .uuid4 ())
146- t .__enter__ ()
147- try :
148- set_header_from_context (input , workflow .payload_converter ())
149- return self .next .start_activity (input )
150- finally :
151- with workflow .unsafe .sandbox_unrestricted ():
152- t .__exit__ ()
145+ with trace (name = f"start_activity:{ input .activity } " , run_id = workflow .uuid4 ()):
146+ set_header_from_context (input , workflow .payload_converter ())
147+ return self .next .start_activity (input )
153148
154149 async def start_child_workflow (
155150 self , input : worker .StartChildWorkflowInput
156151 ) -> workflow .ChildWorkflowHandle :
157152 with workflow .unsafe .sandbox_unrestricted ():
158- t = trace (name = f"start_child_workflow:{ input .workflow } " , run_id = workflow .uuid4 ())
159- try :
160- set_header_from_context (input , workflow .payload_converter ())
161- return await self .next .start_child_workflow (input )
162- finally :
163- with workflow .unsafe .sandbox_unrestricted ():
164- t .__exit__ ()
153+ with trace (name = f"start_child_workflow:{ input .workflow } " , run_id = workflow .uuid4 ()):
154+ set_header_from_context (input , workflow .payload_converter ())
155+ return await self .next .start_child_workflow (input )
0 commit comments