mirror of
https://gitee.com/wanwujie/deer-flow
synced 2026-04-03 06:12:14 +08:00
22 lines
599 B
Python
22 lines
599 B
Python
|
|
from src.sandbox.local.local_sandbox import LocalSandbox
|
||
|
|
from src.sandbox.sandbox import Sandbox
|
||
|
|
from src.sandbox.sandbox_provider import SandboxProvider
|
||
|
|
|
||
|
|
_singleton: LocalSandbox | None = None
|
||
|
|
|
||
|
|
|
||
|
|
class LocalSandboxProvider(SandboxProvider):
|
||
|
|
def acquire(self) -> Sandbox:
|
||
|
|
global _singleton
|
||
|
|
if _singleton is None:
|
||
|
|
_singleton = LocalSandbox("local")
|
||
|
|
return _singleton.id
|
||
|
|
|
||
|
|
def get(self, sandbox_id: str) -> None:
|
||
|
|
if _singleton is None:
|
||
|
|
self.acquire()
|
||
|
|
return _singleton
|
||
|
|
|
||
|
|
def release(self, sandbox_id: str) -> None:
|
||
|
|
pass
|