Compare commits

..

2 Commits

Author SHA1 Message Date
27049f00ea Merge pull request 'quick agent fix' (#24) from zfp-oss into main
Some checks failed
Build Sphinx Docs Set / Build Docs (push) Successful in 21s
Build Project / Build Project (3.10) (push) Successful in 16m7s
Build Project / Build Project (3.12) (push) Successful in 20m21s
Build Project / Build Project (3.11) (push) Successful in 21m9s
Test with tox / Test with tox (3.10) (push) Failing after 21m25s
Test with tox / Test with tox (3.11) (push) Failing after 15m0s
Test with tox / Test with tox (3.12) (push) Failing after 14m7s
Reviewed-on: #24
2026-04-17 11:50:10 -04:00
ben
78ecd171bd quick agent fix
Some checks failed
Build Sphinx Docs Set / Build Docs (pull_request) Successful in 18s
Test with tox / Test with tox (3.10) (pull_request) Failing after 51s
Build Project / Build Project (3.10) (pull_request) Successful in 1m12s
Build Project / Build Project (3.11) (pull_request) Successful in 1m12s
Build Project / Build Project (3.12) (pull_request) Successful in 1m14s
Test with tox / Test with tox (3.12) (pull_request) Failing after 2m29s
Test with tox / Test with tox (3.11) (pull_request) Failing after 1m37s
2026-04-17 11:49:44 -04:00

View File

@ -20,7 +20,7 @@ Usage::
The agent: The agent:
1. Registers with RIA Hub and receives a ``node_id``. 1. Registers with RIA Hub and receives a ``node_id``.
2. Sends a heartbeat every 30 s so the hub knows it is online. 2. Sends a heartbeat every 30 s so the hub knows it is online.
3. Long-polls ``GET /orchestrator/nodes/{id}/commands`` (30 s timeout). 3. Long-polls ``GET /composer/nodes/{id}/commands`` (30 s timeout).
4. Dispatches received commands: 4. Dispatches received commands:
- ``run_campaign``: executes via CampaignExecutor, uploads recordings. - ``run_campaign``: executes via CampaignExecutor, uploads recordings.
- ``load_model``: loads an ONNX fingerprint or detector model. - ``load_model``: loads an ONNX fingerprint or detector model.
@ -173,7 +173,7 @@ class NodeAgent:
if self._ort_available: if self._ort_available:
capabilities.append("inference") capabilities.append("inference")
resp = self._post( resp = self._post(
"/orchestrator/nodes/register", "/composer/nodes/register",
json={ json={
"name": self.name, "name": self.name,
"sdr_device": self.sdr_device, "sdr_device": self.sdr_device,
@ -190,7 +190,7 @@ class NodeAgent:
if not self.node_id: if not self.node_id:
return return
try: try:
self._delete(f"/orchestrator/nodes/{self.node_id}", timeout=10) self._delete(f"/composer/nodes/{self.node_id}", timeout=10)
logger.info("Deregistered %s", self.node_id) logger.info("Deregistered %s", self.node_id)
except Exception as exc: except Exception as exc:
logger.debug("Deregister failed (ignored on shutdown): %s", exc) logger.debug("Deregister failed (ignored on shutdown): %s", exc)
@ -202,7 +202,7 @@ class NodeAgent:
def _heartbeat_loop(self) -> None: def _heartbeat_loop(self) -> None:
while not self._stop.wait(_HEARTBEAT_INTERVAL): while not self._stop.wait(_HEARTBEAT_INTERVAL):
try: try:
resp = self._post(f"/orchestrator/nodes/{self.node_id}/heartbeat", timeout=10) resp = self._post(f"/composer/nodes/{self.node_id}/heartbeat", timeout=10)
if resp.status_code == 404: if resp.status_code == 404:
logger.warning("Heartbeat got 404 — hub lost registration, re-registering") logger.warning("Heartbeat got 404 — hub lost registration, re-registering")
self._register() self._register()
@ -217,7 +217,7 @@ class NodeAgent:
while not self._stop.is_set(): while not self._stop.is_set():
try: try:
resp = self._get( resp = self._get(
f"/orchestrator/nodes/{self.node_id}/commands", f"/composer/nodes/{self.node_id}/commands",
timeout=_POLL_CLIENT_TIMEOUT, timeout=_POLL_CLIENT_TIMEOUT,
) )
if resp.status_code == 204: if resp.status_code == 204:
@ -540,7 +540,7 @@ class NodeAgent:
logger.info("Inference loop exited") logger.info("Inference loop exited")
def _post_event(self, device_id: str | None, confidence: float, snr_db: float) -> None: def _post_event(self, device_id: str | None, confidence: float, snr_db: float) -> None:
"""POST a single detection event to ``POST /orchestrator/nodes/{id}/events``. """POST a single detection event to ``POST /composer/nodes/{id}/events``.
Failures are logged at DEBUG level and silently swallowed so that a Failures are logged at DEBUG level and silently swallowed so that a
transient network blip does not crash the inference loop. transient network blip does not crash the inference loop.
@ -556,7 +556,7 @@ class NodeAgent:
} }
try: try:
resp = self._post( resp = self._post(
f"/orchestrator/nodes/{self.node_id}/events", f"/composer/nodes/{self.node_id}/events",
json=payload, json=payload,
timeout=5, timeout=5,
) )
@ -619,7 +619,7 @@ class NodeAgent:
payload["error"] = error payload["error"] = error
try: try:
resp = self._post( resp = self._post(
f"/orchestrator/nodes/{self.node_id}/campaign-status", f"/composer/nodes/{self.node_id}/campaign-status",
json=payload, json=payload,
timeout=15, timeout=15,
) )