From 8adba1597621ffec6d42cff81ecc6cf7ebd5155d Mon Sep 17 00:00:00 2001 From: OrenZ1 <103062152+OrenZ1@users.noreply.github.com> Date: Thu, 29 Feb 2024 15:23:48 +0200 Subject: [PATCH 1/3] Added better handling for empty status of kernel container during kernel startup --- .../services/processproxies/container.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/enterprise_gateway/services/processproxies/container.py b/enterprise_gateway/services/processproxies/container.py index 6378b633..c4c55dfc 100644 --- a/enterprise_gateway/services/processproxies/container.py +++ b/enterprise_gateway/services/processproxies/container.py @@ -190,7 +190,15 @@ async def confirm_remote_startup(self) -> None: """Confirms the container has started and returned necessary connection information.""" self.log.debug("Trying to confirm kernel container startup status") self.start_time = RemoteProcessProxy.get_current_time() - i = 0 + i = 1 + container_status = self.get_container_status(i) + while not container_status: + i += 1 + self.detect_launch_failure() + await self.handle_timeout() + + container_status = self.get_container_status(i) + ready_to_connect = False # we're ready to connect when we have a connection file to use while not ready_to_connect: i += 1 @@ -211,7 +219,11 @@ async def confirm_remote_startup(self) -> None: ) self.pgid = 0 else: - self.detect_launch_failure() + self.log_and_raise( + http_status_code=500, + reason="Error starting kernel container; status not available. " + "Perhaps the kernel pod died unexpectedly" + ) def get_process_info(self) -> dict[str, Any]: """Captures the base information necessary for kernel persistence relative to containers.""" From b255c43c8b07cee302b1e1bcd3684c94d06a9fb9 Mon Sep 17 00:00:00 2001 From: OrenZ1 <103062152+OrenZ1@users.noreply.github.com> Date: Thu, 29 Feb 2024 15:48:57 +0200 Subject: [PATCH 2/3] Modified grammer of error message --- enterprise_gateway/services/processproxies/container.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/enterprise_gateway/services/processproxies/container.py b/enterprise_gateway/services/processproxies/container.py index c4c55dfc..1ea3089e 100644 --- a/enterprise_gateway/services/processproxies/container.py +++ b/enterprise_gateway/services/processproxies/container.py @@ -221,7 +221,7 @@ async def confirm_remote_startup(self) -> None: else: self.log_and_raise( http_status_code=500, - reason="Error starting kernel container; status not available. " + reason="Error starting kernel container; status was not available. " "Perhaps the kernel pod died unexpectedly" ) From c9da1f198fdbde6619c9e7a868b6e94748abd6e8 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Thu, 29 Feb 2024 13:53:51 +0000 Subject: [PATCH 3/3] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- enterprise_gateway/services/processproxies/container.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/enterprise_gateway/services/processproxies/container.py b/enterprise_gateway/services/processproxies/container.py index 1ea3089e..edae7a85 100644 --- a/enterprise_gateway/services/processproxies/container.py +++ b/enterprise_gateway/services/processproxies/container.py @@ -198,7 +198,7 @@ async def confirm_remote_startup(self) -> None: await self.handle_timeout() container_status = self.get_container_status(i) - + ready_to_connect = False # we're ready to connect when we have a connection file to use while not ready_to_connect: i += 1 @@ -222,7 +222,7 @@ async def confirm_remote_startup(self) -> None: self.log_and_raise( http_status_code=500, reason="Error starting kernel container; status was not available. " - "Perhaps the kernel pod died unexpectedly" + "Perhaps the kernel pod died unexpectedly", ) def get_process_info(self) -> dict[str, Any]: