MCPcopy Create free account
hub / github.com/NVIDIA/OpenShell / __enter__

Method __enter__

python/openshell/sandbox.py:688–711  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

686 return self._session.sandbox
687
688 def __enter__(self) -> Sandbox:
689 client = SandboxClient.from_active_cluster(
690 cluster=self._cluster,
691 timeout=self._timeout,
692 auto_refresh=self._auto_refresh,
693 write_back=self._write_back,
694 insecure=self._insecure,
695 )
696 self._client = client
697
698 if self._sandbox_input is None:
699 self._session = client.create_session(spec=self._spec)
700 elif isinstance(self._sandbox_input, SandboxRef):
701 self._session = SandboxSession(client, self._sandbox_input)
702 else:
703 self._session = client.get_session(self._sandbox_input)
704
705 ready = client.wait_ready(
706 self._session.sandbox.name,
707 timeout_seconds=self._ready_timeout_seconds,
708 )
709 self._session = SandboxSession(client, ready)
710
711 return self
712
713 def __exit__(self, *args: object) -> None:
714 try:

Calls 5

SandboxSessionClass · 0.85
from_active_clusterMethod · 0.80
create_sessionMethod · 0.80
get_sessionMethod · 0.80
wait_readyMethod · 0.80