@@ -257,6 +257,7 @@ async def create_async(
257257 nas_config = nas_config ,
258258 oss_mount_config = oss_mount_config ,
259259 polar_fs_config = polar_fs_config ,
260+ config = config ,
260261 )
261262
262263 # 根据 template 类型转换为对应的子类实例
@@ -332,6 +333,7 @@ def create(
332333 nas_config = nas_config ,
333334 oss_mount_config = oss_mount_config ,
334335 polar_fs_config = polar_fs_config ,
336+ config = config ,
335337 )
336338
337339 # 根据 template 类型转换为对应的子类实例
@@ -361,66 +363,72 @@ def create(
361363 return sandbox
362364
363365 @classmethod
364- async def stop_by_id_async (cls , sandbox_id : str ):
366+ async def stop_by_id_async (
367+ cls , sandbox_id : str , config : Optional [Config ] = None
368+ ):
365369 """通过 ID 停止 Sandbox(异步)
366370
367371 Args:
368372 sandbox_id: Sandbox ID
369- config: 配置对象
373+ config: 配置对象 / Config object
370374
371375 Returns:
372376 Sandbox: Sandbox 对象
373377 """
374378 if sandbox_id is None :
375379 raise ValueError ("sandbox_id is required" )
376- # todo 后续适配后使用 stop()
377- return await cls .__get_client ().stop_sandbox_async (sandbox_id )
380+ return await cls .__get_client ().stop_sandbox_async (
381+ sandbox_id , config = config
382+ )
378383
379384 @classmethod
380- def stop_by_id (cls , sandbox_id : str ):
385+ def stop_by_id (cls , sandbox_id : str , config : Optional [ Config ] = None ):
381386 """通过 ID 停止 Sandbox(同步)
382387
383388 Args:
384389 sandbox_id: Sandbox ID
385- config: 配置对象
390+ config: 配置对象 / Config object
386391
387392 Returns:
388393 Sandbox: Sandbox 对象
389394 """
390395 if sandbox_id is None :
391396 raise ValueError ("sandbox_id is required" )
392- # todo 后续适配后使用 stop()
393- return cls .__get_client ().stop_sandbox (sandbox_id )
397+ return cls .__get_client ().stop_sandbox (sandbox_id , config = config )
394398
395399 @classmethod
396- async def delete_by_id_async (cls , sandbox_id : str ):
400+ async def delete_by_id_async (
401+ cls , sandbox_id : str , config : Optional [Config ] = None
402+ ):
397403 """通过 ID 删除 Sandbox(异步)
398404
399405 Args:
400406 sandbox_id: Sandbox ID
401- config: 配置对象
407+ config: 配置对象 / Config object
402408
403409 Returns:
404410 Sandbox: Sandbox 对象
405411 """
406412 if sandbox_id is None :
407413 raise ValueError ("sandbox_id is required" )
408- return await cls .__get_client ().delete_sandbox_async (sandbox_id )
414+ return await cls .__get_client ().delete_sandbox_async (
415+ sandbox_id , config = config
416+ )
409417
410418 @classmethod
411- def delete_by_id (cls , sandbox_id : str ):
419+ def delete_by_id (cls , sandbox_id : str , config : Optional [ Config ] = None ):
412420 """通过 ID 删除 Sandbox(同步)
413421
414422 Args:
415423 sandbox_id: Sandbox ID
416- config: 配置对象
424+ config: 配置对象 / Config object
417425
418426 Returns:
419427 Sandbox: Sandbox 对象
420428 """
421429 if sandbox_id is None :
422430 raise ValueError ("sandbox_id is required" )
423- return cls .__get_client ().delete_sandbox (sandbox_id )
431+ return cls .__get_client ().delete_sandbox (sandbox_id , config = config )
424432
425433 @classmethod
426434 async def list_async (
@@ -866,34 +874,34 @@ async def get_async(self):
866874 if self .sandbox_id is None :
867875 raise ValueError ("sandbox_id is required to get a Sandbox" )
868876
869- return await self .connect_async (self .sandbox_id )
877+ return await self .connect_async (self .sandbox_id , config = self . _config )
870878
871879 def get (self ):
872880 if self .sandbox_id is None :
873881 raise ValueError ("sandbox_id is required to get a Sandbox" )
874882
875- return self .connect (self .sandbox_id )
883+ return self .connect (self .sandbox_id , config = self . _config )
876884
877885 async def delete_async (self ):
878886 if self .sandbox_id is None :
879887 raise ValueError ("sandbox_id is required to delete a Sandbox" )
880888
881- return await self .delete_by_id_async (self .sandbox_id )
889+ return await self .delete_by_id_async (
890+ self .sandbox_id , config = self ._config
891+ )
882892
883893 def delete (self ):
884894 if self .sandbox_id is None :
885895 raise ValueError ("sandbox_id is required to delete a Sandbox" )
886896
887- return self .delete_by_id (self .sandbox_id )
897+ return self .delete_by_id (self .sandbox_id , config = self . _config )
888898
889899 async def stop_async (self ):
890900 if self .sandbox_id is None :
891901 raise ValueError ("sandbox_id is required to stop a Sandbox" )
892- # todo 后续适配后使用 stop()
893- return await self .stop_by_id_async (self .sandbox_id )
902+ return await self .stop_by_id_async (self .sandbox_id , config = self ._config )
894903
895904 def stop (self ):
896905 if self .sandbox_id is None :
897906 raise ValueError ("sandbox_id is required to stop a Sandbox" )
898- # todo 后续适配后使用 stop()
899- return self .stop_by_id (self .sandbox_id )
907+ return self .stop_by_id (self .sandbox_id , config = self ._config )
0 commit comments