From f17312d568904b75e3dd06b164f457b709fbd51c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E0=AE=AE=E0=AE=A9=E0=AF=8B=E0=AE=9C=E0=AF=8D=E0=AE=95?= =?UTF-8?q?=E0=AF=81=E0=AE=AE=E0=AE=BE=E0=AE=B0=E0=AF=8D=20=E0=AE=AA?= =?UTF-8?q?=E0=AE=B4=E0=AE=A9=E0=AE=BF=E0=AE=9A=E0=AF=8D=E0=AE=9A=E0=AE=BE?= =?UTF-8?q?=E0=AE=AE=E0=AE=BF?= Date: Thu, 22 Aug 2024 11:31:39 +0530 Subject: [PATCH] fix log_buffer --- openhands/runtime/client/client.py | 3 ++- openhands/runtime/client/runtime.py | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/openhands/runtime/client/client.py b/openhands/runtime/client/client.py index 326dcf50f18e..8b2fff384a19 100644 --- a/openhands/runtime/client/client.py +++ b/openhands/runtime/client/client.py @@ -633,7 +633,8 @@ async def execute_action(action_request: ActionRequest): observation = await client.run_action(action) return event_to_dict(observation) except Exception as e: - logger.error(f'Error processing command: {str(e)}') + logger.error(f'Error processing command: {e}') + logger.exception(e) raise HTTPException(status_code=500, detail=str(e)) @app.post('/upload_file') diff --git a/openhands/runtime/client/runtime.py b/openhands/runtime/client/runtime.py index 940da1ec7d35..8c66674c752d 100644 --- a/openhands/runtime/client/runtime.py +++ b/openhands/runtime/client/runtime.py @@ -179,6 +179,8 @@ async def ainit(self, env_vars: dict[str, str] | None = None): self.container = self.docker_client.containers.get(self.container_name) await self.start_docker_container() + self.log_buffer = LogBuffer(self.container) + @staticmethod def _init_docker_client() -> docker.DockerClient: try: @@ -259,7 +261,6 @@ async def _init_container( environment={'DEBUG': 'true'} if self.config.debug else None, volumes=volumes, ) - self.log_buffer = LogBuffer(container) logger.info(f'Container started. Server url: {self.api_url}') return container except Exception as e: