mirror of
https://github.com/bytedance/deer-flow.git
synced 2026-05-22 16:06:50 +00:00
23 lines
651 B
Python
23 lines
651 B
Python
from src.sandbox.local.local_sandbox import LocalSandbox
|
|
from src.sandbox.sandbox_provider import SandboxProvider
|
|
|
|
_singleton: LocalSandbox | None = None
|
|
|
|
|
|
class LocalSandboxProvider(SandboxProvider):
|
|
def acquire(self, thread_id: str | None = None) -> str:
|
|
global _singleton
|
|
if _singleton is None:
|
|
_singleton = LocalSandbox("local")
|
|
return _singleton.id
|
|
|
|
def get(self, sandbox_id: str) -> None:
|
|
if sandbox_id == "local":
|
|
if _singleton is None:
|
|
self.acquire()
|
|
return _singleton
|
|
return None
|
|
|
|
def release(self, sandbox_id: str) -> None:
|
|
pass
|