@@ -233,8 +233,8 @@ def build_on_demand_sandbox_worker_heartbeat(active_activities_count: int) -> pb
233233 active_activities_count = active_activities_count ))
234234
235235
236- class OnDemandSandboxActivitiesClient :
237- """Client for Durable Task Scheduler on-demand sandbox activity management operations ."""
236+ class _OnDemandSandboxActivitiesGrpcClient :
237+ """Internal gRPC client for on-demand sandbox activity RPCs ."""
238238
239239 def __init__ (
240240 self , * ,
@@ -266,25 +266,60 @@ def close(self) -> None:
266266 if self ._owns_channel :
267267 self ._channel .close ()
268268
269+ def declare_on_demand_sandbox_activities (
270+ self ,
271+ declaration : pb .OnDemandSandboxActivityDeclaration ) -> pb .OnDemandSandboxActivityDeclarationResult :
272+ return self ._stub .DeclareOnDemandSandboxActivities (declaration )
273+
274+ def remove_on_demand_sandbox_activity_declaration (
275+ self ,
276+ worker_profile_id : str ) -> pb .RemoveOnDemandSandboxActivityDeclarationResult :
277+ return self ._stub .RemoveOnDemandSandboxActivityDeclaration (
278+ pb .RemoveOnDemandSandboxActivityDeclarationRequest (worker_profile_id = worker_profile_id ))
279+
280+ def connect_on_demand_sandbox_activity_worker (
281+ self ,
282+ messages : Iterable [pb .OnDemandSandboxActivityWorkerMessage ]
283+ ) -> pb .OnDemandSandboxActivityWorkerSessionResult :
284+ return self ._stub .ConnectOnDemandSandboxActivityWorker (messages )
285+
286+
287+ class OnDemandSandboxActivitiesClient :
288+ """Client for Durable Task Scheduler on-demand sandbox activity management operations."""
289+
290+ def __init__ (
291+ self , * ,
292+ host_address : str ,
293+ taskhub : str ,
294+ token_credential : Optional [TokenCredential ],
295+ channel : Optional [grpc .Channel ] = None ,
296+ secure_channel : bool = True ,
297+ interceptors : Optional [Sequence [shared .ClientInterceptor ]] = None ,
298+ channel_options : Optional [GrpcChannelOptions ] = None ):
299+ self ._grpc_client = _OnDemandSandboxActivitiesGrpcClient (
300+ host_address = host_address ,
301+ taskhub = taskhub ,
302+ token_credential = token_credential ,
303+ channel = channel ,
304+ secure_channel = secure_channel ,
305+ interceptors = interceptors ,
306+ channel_options = channel_options )
307+
308+ def close (self ) -> None :
309+ self ._grpc_client .close ()
310+
269311 def enable_on_demand_sandbox_activities (self ) -> None :
270312 """Declare all configured on-demand sandbox worker profiles with Durable Task Scheduler."""
271313 declarations = build_profile_on_demand_sandbox_activity_declarations ()
272314 if not declarations :
273315 raise ValueError ("No configured on-demand sandbox activities were found." )
274316
275317 for declaration in declarations :
276- self ._stub . DeclareOnDemandSandboxActivities (declaration )
318+ self ._grpc_client . declare_on_demand_sandbox_activities (declaration )
277319
278320 def remove_on_demand_sandbox_activity_declaration (self , worker_profile_id : str ) -> None :
279321 worker_profile_id = _normalize_required (worker_profile_id , "Worker profile ID is required." )
280- self ._stub .RemoveOnDemandSandboxActivityDeclaration (
281- pb .RemoveOnDemandSandboxActivityDeclarationRequest (worker_profile_id = worker_profile_id ))
282-
283- def connect_on_demand_sandbox_activity_worker (
284- self ,
285- messages : Iterable [pb .OnDemandSandboxActivityWorkerMessage ]
286- ) -> pb .OnDemandSandboxActivityWorkerSessionResult :
287- return self ._stub .ConnectOnDemandSandboxActivityWorker (messages )
322+ self ._grpc_client .remove_on_demand_sandbox_activity_declaration (worker_profile_id )
288323
289324
290325def _normalize_optional_strings (values : Iterable [str ]) -> list [str ]:
0 commit comments