def wait_for_server()

in src/backend/run_backend.py [0:0]


    def wait_for_server(self, backend_type, timeout=3000, check_interval=10):
        """
        Wait for the server to be ready by checking the health endpoint and container status.
        
        Args:
            timeout (int): Maximum time to wait in seconds
            check_interval (int): Time between checks in seconds
        
        Returns:
            bool: True if server is ready, False otherwise
        """   
        start_time = time.time()
        attempts = 0
        while time.time() - start_time < timeout:
            try:
                # Check if container is still running
                result = subprocess.run(
                    f"docker inspect -f '{{{{.State.Status}}}}' {BENCHMARKING_CONTAINER_NAME}",
                    shell=True,
                    capture_output=True,
                    text=True
                )
                
                if result.returncode == 0:
                    status = result.stdout.strip()
                    if status == 'exited':
                        # Get container logs to help with debugging
                        subprocess.run(f"docker logs {BENCHMARKING_CONTAINER_NAME}", shell=True)
                        raise RuntimeError("Container exited before becoming ready")
                    elif status != 'running':
                        raise RuntimeError(f"Container is in unexpected state: {status}")
                
                # Check if server is responding
                url = "http://localhost:8080/health"
                response = requests.get(url)
                if response.status_code == 200:
                    return True
            except requests.exceptions.RequestException:
                pass
            except RuntimeError as e:
                logger.error(f"Container failed: {str(e)}")
                return False
            
            time.sleep(check_interval)
            attempts += 1
            if attempts % 1 == 0:
                logger.info(f"Waiting for server to be ready... ({int(time.time() - start_time)}s)")
        
        # If we timeout, get container logs to help with debugging
        subprocess.run(f"docker logs {BENCHMARKING_CONTAINER_NAME}", shell=True)
        return False