@@ -159,10 +159,15 @@ def __init__(self, *,
159159 secure_channel = secure_channel ,
160160 interceptors = interceptors
161161 )
162+ self ._channel = channel
162163 self ._stub = stubs .TaskHubSidecarServiceStub (channel )
163164 self ._logger = shared .get_logger ("client" , log_handler , log_formatter )
164165 self .default_version = default_version
165166
167+ def close (self ) -> None :
168+ """Closes the underlying gRPC channel."""
169+ self ._channel .close ()
170+
166171 def schedule_new_orchestration (self , orchestrator : Union [task .Orchestrator [TInput , TOutput ], str ], * ,
167172 input : Optional [TInput ] = None ,
168173 instance_id : Optional [str ] = None ,
@@ -239,26 +244,26 @@ def wait_for_orchestration_completion(self, instance_id: str, *,
239244 raise
240245
241246 def raise_orchestration_event (self , instance_id : str , event_name : str , * ,
242- data : Optional [Any ] = None ):
247+ data : Optional [Any ] = None ) -> None :
243248 req = build_raise_event_req (instance_id , event_name , data )
244249
245250 self ._logger .info (f"Raising event '{ event_name } ' for instance '{ instance_id } '." )
246251 self ._stub .RaiseEvent (req )
247252
248253 def terminate_orchestration (self , instance_id : str , * ,
249254 output : Optional [Any ] = None ,
250- recursive : bool = True ):
255+ recursive : bool = True ) -> None :
251256 req = build_terminate_req (instance_id , output , recursive )
252257
253258 self ._logger .info (f"Terminating instance '{ instance_id } '." )
254259 self ._stub .TerminateInstance (req )
255260
256- def suspend_orchestration (self , instance_id : str ):
261+ def suspend_orchestration (self , instance_id : str ) -> None :
257262 req = pb .SuspendRequest (instanceId = instance_id )
258263 self ._logger .info (f"Suspending instance '{ instance_id } '." )
259264 self ._stub .SuspendInstance (req )
260265
261- def resume_orchestration (self , instance_id : str ):
266+ def resume_orchestration (self , instance_id : str ) -> None :
262267 req = pb .ResumeRequest (instanceId = instance_id )
263268 self ._logger .info (f"Resuming instance '{ instance_id } '." )
264269 self ._stub .ResumeInstance (req )
@@ -370,10 +375,15 @@ def __init__(self, *,
370375 secure_channel = secure_channel ,
371376 interceptors = interceptors
372377 )
378+ self ._channel = channel
373379 self ._stub = stubs .TaskHubSidecarServiceStub (channel )
374380 self ._logger = shared .get_logger ("client" , log_handler , log_formatter )
375381 self .default_version = default_version
376382
383+ async def close (self ) -> None :
384+ """Closes the underlying gRPC channel."""
385+ await self ._channel .close ()
386+
377387 async def schedule_new_orchestration (self , orchestrator : Union [task .Orchestrator [TInput , TOutput ], str ], * ,
378388 input : Optional [TInput ] = None ,
379389 instance_id : Optional [str ] = None ,
@@ -450,26 +460,26 @@ async def wait_for_orchestration_completion(self, instance_id: str, *,
450460 raise
451461
452462 async def raise_orchestration_event (self , instance_id : str , event_name : str , * ,
453- data : Optional [Any ] = None ):
463+ data : Optional [Any ] = None ) -> None :
454464 req = build_raise_event_req (instance_id , event_name , data )
455465
456466 self ._logger .info (f"Raising event '{ event_name } ' for instance '{ instance_id } '." )
457467 await self ._stub .RaiseEvent (req )
458468
459469 async def terminate_orchestration (self , instance_id : str , * ,
460470 output : Optional [Any ] = None ,
461- recursive : bool = True ):
471+ recursive : bool = True ) -> None :
462472 req = build_terminate_req (instance_id , output , recursive )
463473
464474 self ._logger .info (f"Terminating instance '{ instance_id } '." )
465475 await self ._stub .TerminateInstance (req )
466476
467- async def suspend_orchestration (self , instance_id : str ):
477+ async def suspend_orchestration (self , instance_id : str ) -> None :
468478 req = pb .SuspendRequest (instanceId = instance_id )
469479 self ._logger .info (f"Suspending instance '{ instance_id } '." )
470480 await self ._stub .SuspendInstance (req )
471481
472- async def resume_orchestration (self , instance_id : str ):
482+ async def resume_orchestration (self , instance_id : str ) -> None :
473483 req = pb .ResumeRequest (instanceId = instance_id )
474484 self ._logger .info (f"Resuming instance '{ instance_id } '." )
475485 await self ._stub .ResumeInstance (req )
0 commit comments