chores: open the websockets ports for port mapping and remove chores. (#2864)

* add port map

* add more comments TODO
This commit is contained in:
Yufan Song
2024-07-08 22:33:58 -07:00
committed by GitHub
parent 8cfb1be5a3
commit f0bc231f3e
2 changed files with 8 additions and 6 deletions

View File

@@ -32,6 +32,8 @@ class RuntimeClient():
def __init__(self) -> None:
self.init_shell()
# TODO: code will block at init_websocket, maybe we can open a subprocess to run websocket forever
# In case we need to run other code after init_websocket
self.init_websocket()
def init_websocket(self) -> None:
@@ -179,11 +181,10 @@ class RuntimeClient():
output, exit_code = self.execute(
'source /opendevin/bash.bashrc && source ~/.bashrc'
)
print("Yufan:",exit_code, output)
# if exit_code != 0:
# raise RuntimeError(
# f'Failed to source /opendevin/bash.bashrc and ~/.bashrc with exit code {exit_code} and output: {output}'
# )
if exit_code != 0:
raise RuntimeError(
f'Failed to source /opendevin/bash.bashrc and ~/.bashrc with exit code {exit_code} and output: {output}'
)
print('Sourced /opendevin/bash.bashrc and ~/.bashrc successfully')

View File

@@ -88,11 +88,12 @@ class EventStreamRuntime(Runtime):
self.container = self.docker_client.containers.run(
self.container_image,
command='tail -f /dev/null',
# TODO: test it in mac and linux
# TODO: test the port mapping in mac and linux
# network_mode='host',
working_dir=self.sandbox_workspace_dir,
name=self.container_name,
detach=True,
ports={'8080/tcp': 8080},
volumes={mount_dir: {'bind': self.sandbox_workspace_dir, 'mode': 'rw'}},
)
print('Container started')