Fix training agent heartbeat status
This commit is contained in:
@@ -206,9 +206,18 @@ class TrainingCoordinator:
|
||||
last_seen = _parse_time(str(worker.get("last_seen_at") or ""))
|
||||
active = self._active_job(state)
|
||||
latest = _latest_job(state)
|
||||
recently_seen = bool(last_seen and datetime.now(UTC) - last_seen <= ONLINE_WINDOW)
|
||||
agent_busy = bool(
|
||||
active
|
||||
and active.get("status") == "running"
|
||||
and worker
|
||||
and active.get("claimed_by") == worker.get("id")
|
||||
)
|
||||
return {
|
||||
"available": True,
|
||||
"agent_online": bool(last_seen and datetime.now(UTC) - last_seen <= ONLINE_WINDOW),
|
||||
"agent_online": recently_seen or agent_busy,
|
||||
"agent_recently_seen": recently_seen,
|
||||
"agent_busy": agent_busy,
|
||||
"worker": worker,
|
||||
"active_job": active,
|
||||
"latest_job": latest,
|
||||
|
||||
Reference in New Issue
Block a user