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.
This commit is contained in:
pyr0ball 2026-05-05 20:36:08 -07:00
parent f952ec8971
commit 55b017ba3b
2 changed files with 3 additions and 3 deletions

View file

@ -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": []}

View file

@ -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": {