Skip to content

Commit

Permalink
fix bug exec isolation wasn't setting resources
Browse files Browse the repository at this point in the history
  • Loading branch information
dillonalaird committed Sep 3, 2024
1 parent 1802d69 commit c8453e7
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions vision_agent/utils/execute.py
Original file line number Diff line number Diff line change
Expand Up @@ -565,10 +565,11 @@ def __init__(
super().__init__(timeout=timeout)
self.nb = nbformat.v4.new_notebook()
# Set the notebook execution path to the remote path
self.resources = {"metadata": {"path": str(self.remote_path)}}
self.nb_client = NotebookClient(
self.nb,
timeout=self.timeout,
resources={"metadata": {"path": str(self.remote_path)}},
resources=self.resources,
)
_LOGGER.info(
f"""Local code interpreter initialized
Expand Down Expand Up @@ -611,7 +612,9 @@ def close(self) -> None:
def restart_kernel(self) -> None:
self.close()
self.nb = nbformat.v4.new_notebook()
self.nb_client = NotebookClient(self.nb, timeout=self.timeout)
self.nb_client = NotebookClient(
self.nb, timeout=self.timeout, resources=self.resources
)
sleep(1)
self._new_kernel()

Expand Down Expand Up @@ -677,7 +680,8 @@ def get_default_instance() -> CodeInterpreter:

@staticmethod
def new_instance(
code_sandbox_runtime: Optional[str] = None, remote_path: Optional[str] = None
code_sandbox_runtime: Optional[str] = None,
remote_path: Optional[Union[str, Path]] = None,
) -> CodeInterpreter:
if not code_sandbox_runtime:
code_sandbox_runtime = os.getenv("CODE_SANDBOX_RUNTIME", "local")
Expand Down

0 comments on commit c8453e7

Please sign in to comment.