health
health
¶
Health check infrastructure for daemon readiness and liveness probes.
Provides HealthChecker with two probe types:
- Liveness: Is the daemon process alive and responsive? Always returns OK if the daemon can execute the handler at all.
- Readiness: Is the daemon ready to accept new jobs? Checks resource
limits via
ResourceMonitorto implement backpressure signaling.
These are registered as JSON-RPC methods (daemon.health, daemon.ready)
so clients (CLI, orchestrators) can query them over the Unix socket.
Evolution v25: Entropy Response Activation - periodic entropy checks trigger automatic diversity injection when pattern collapse is detected.
Classes¶
HealthChecker
¶
Daemon health and readiness probes.
Evolution v25: Entropy Response Activation - added periodic entropy monitoring and automatic diversity injection when collapse is detected.
Parameters¶
manager:
The JobManager instance for job count queries.
monitor:
The ResourceMonitor instance for resource threshold checks.
learning_store:
Optional learning store for entropy monitoring. If None, entropy
checks are disabled.
Source code in src/marianne/daemon/health.py
Functions¶
liveness
async
¶
Is the daemon process alive and responsive?
This is the cheapest possible check — if the daemon can execute this handler and return a response, it's alive. No resource checks or I/O are performed.
Source code in src/marianne/daemon/health.py
readiness
async
¶
Is the daemon ready to accept new jobs?
Checks resource thresholds via the monitor, job failure rate
via the manager, and notification health. Returns "ready"
when resources are within limits, the failure rate is not
elevated, and notifications are functional; "not_ready"
otherwise.
Source code in src/marianne/daemon/health.py
on_job_completed
¶
Called by JobManager when a job completes.
Evolution v25: Entropy Response Activation - tracks completed jobs to trigger entropy checks every 10 completions.
Source code in src/marianne/daemon/health.py
start_periodic_checks
async
¶
Start background task for periodic entropy checks.
Evolution v25: Entropy Response Activation - runs entropy checks at configured intervals (default 1 hour).
Source code in src/marianne/daemon/health.py
stop_periodic_checks
async
¶
Stop the periodic entropy check task.
Evolution v25: Entropy Response Activation - cleanly shuts down the entropy monitoring loop.