mirror of
https://github.com/OpenHands/OpenHands.git
synced 2026-03-22 13:47:19 +08:00
chores: open the websockets ports for port mapping and remove chores. (#2864)
* add port map * add more comments TODO
This commit is contained in:
@@ -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')
|
||||
|
||||
|
||||
|
||||
@@ -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')
|
||||
|
||||
Reference in New Issue
Block a user