From 55b017ba3bdb9be2e79252b8b1dff15d9c2d1a17 Mon Sep 17 00:00:00 2001 From: pyr0ball Date: Tue, 5 May 2026 20:36:08 -0700 Subject: [PATCH] fix: log coordinator reload failures in update_gpu_services - Replace bare `except Exception: pass` with `except Exception as exc` and a logger.warning call that surfaces node_id and the exception for diagnostics. - Move `import os as _os` from mid-file (between test functions) to the top-level import block to satisfy PEP 8 and linter expectations. --- app/nodes.py | 4 ++-- tests/test_nodes.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/nodes.py b/app/nodes.py index 04f557a..c43fa4c 100644 --- a/app/nodes.py +++ b/app/nodes.py @@ -287,7 +287,7 @@ def update_gpu_services(node_id: str, gpu_id: int, body: UpdateServicesRequest) f"{coordinator_url}/api/nodes/{node_id}/reload-profile", timeout=5.0 ) reloaded = rr.status_code < 300 - except Exception: - pass + except Exception as exc: + logger.warning("Coordinator reload failed for node %s: %s", node_id, exc) return {"ok": True, "reloaded": reloaded, "warnings": []} diff --git a/tests/test_nodes.py b/tests/test_nodes.py index 858724a..fb04d22 100644 --- a/tests/test_nodes.py +++ b/tests/test_nodes.py @@ -7,6 +7,7 @@ import pytest import yaml from fastapi.testclient import TestClient from unittest.mock import MagicMock, patch +import os as _os @pytest.fixture(autouse=True) @@ -202,7 +203,6 @@ def test_get_profile_500_on_malformed_yaml(client, tmp_path): # ── POST /api/nodes-mgmt/nodes/{node_id}/gpu/{gpu_id}/services ───────────────── -import os as _os _BASE_PROFILE = { "services": {