From 5718fe90046b7c93c613e9d4c40e2ab92d6742c5 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 14 Jan 2026 19:00:48 +0000 Subject: [PATCH 1/2] Initial plan From 021e184bf874ca46398d9c9b53c12a1cec87ee76 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 14 Jan 2026 19:15:40 +0000 Subject: [PATCH 2/2] Refactor pod readiness polling to use wait_for_ready helper Co-authored-by: gaganso <27358592+gaganso@users.noreply.github.com> --- .../misconfig_app/misconfig_app_hotel_res.py | 37 ++++--------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/aiopslab/orchestrator/problems/misconfig_app/misconfig_app_hotel_res.py b/aiopslab/orchestrator/problems/misconfig_app/misconfig_app_hotel_res.py index 822d777d..58084577 100644 --- a/aiopslab/orchestrator/problems/misconfig_app/misconfig_app_hotel_res.py +++ b/aiopslab/orchestrator/problems/misconfig_app/misconfig_app_hotel_res.py @@ -3,7 +3,6 @@ """MongoDB storage user unregistered problem in the HotelReservation application.""" -from time import sleep from typing import Any from aiopslab.orchestrator.tasks import * @@ -167,32 +166,12 @@ def eval(self, soln: Any, trace: list[SessionItem], duration: float) -> dict: super().eval(soln, trace, duration) # Check if all services (not only faulty service) is back to normal (Running) - all_normal = True - # Polling for 1 minute to check if all services are back to normal - for _ in range(12): # 5 seconds interval, 12 times, total 1 minute - pod_list = self.kubectl.list_pods(self.namespace) - for pod in pod_list.items: - # Check container statuses - for container_status in pod.status.container_statuses: - if container_status.state.waiting: - reason = container_status.state.waiting.reason - if reason in ["CrashLoopBackOff", "Error", "ImagePullBackOff", "ErrImagePull"]: - print(f"Container {container_status.name} is in error state: {reason}") - all_normal = False - elif container_status.state.terminated and container_status.state.terminated.reason != "Completed": - print(f"Container {container_status.name} is terminated with reason: {container_status.state.terminated.reason}") - all_normal = False - elif not container_status.ready: - print(f"Container {container_status.name} is not ready") - all_normal = False - - if not all_normal: - break - - if not all_normal: - break - # Wait for 5 seconds before checking again - sleep(5) - - self.results["success"] = all_normal + # Use wait_for_ready helper to poll for pod readiness + try: + self.kubectl.wait_for_ready(self.namespace, sleep=5, max_wait=60) + self.results["success"] = True + except Exception as e: + print(f"Pods are not all ready: {e}") + self.results["success"] = False + return self.results