feat(host_agent): a temperature sensor is judged by how it moves against the CPU (#5783)
A board's spare thermistor inputs report whatever an open input reads, and the value rule from #5759 only catches the impossible ones. Once an hour, sensors.refresh judges each sensor against the host's CPU (Package id N, Tctl/Tdie/TccdN, PECI Agent N) over a week of hourly averages. A sensor is ruled out if it falls as the CPU warms (r <= -0.5) or holds within 0.5 °C while the CPU moved 10 °C or more. A judgment needs at least 72 shared hours. The host temperature leaves judged sensors out at ingest. The host page lists them under "Not counted", with each reason given once. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -121,6 +121,29 @@ def make_task(app) -> ScheduledTask:
|
||||
)
|
||||
|
||||
|
||||
def make_sensor_task(app) -> ScheduledTask:
|
||||
"""Re-judges which temperature sensors are thermometers (#5783), hourly
|
||||
and at startup, from the hourly averages: verdicts live in memory, so a
|
||||
restart rebuilds them before the first hour is out."""
|
||||
async def _judge():
|
||||
from . import sensors
|
||||
try:
|
||||
async with app.db_sessionmaker() as session:
|
||||
found = await sensors.refresh(session, datetime.now(timezone.utc))
|
||||
for host, labels in found.items():
|
||||
logger.info("host_agent: %s sensors not counted as temperature: %s",
|
||||
host, ", ".join(sorted(labels)))
|
||||
except Exception:
|
||||
logger.exception("host_agent: judging temperature sensors failed")
|
||||
|
||||
return ScheduledTask(
|
||||
name="host_agent_sensors",
|
||||
coro_factory=_judge,
|
||||
interval_seconds=3600,
|
||||
run_on_startup=True,
|
||||
)
|
||||
|
||||
|
||||
def make_maintenance_task(app) -> ScheduledTask:
|
||||
"""Gives up on maintenance jobs past their deadline (#5767), starts due
|
||||
maintenance plans and moves their runs on one host at a time (#5768), and
|
||||
|
||||
Reference in New Issue
Block a user