| Safe Haskell | None |
|---|---|
| Language | GHC2021 |
Ecluse.Core.Worker.Liveness
Description
The mirror worker heartbeat behind /livez, shared by embedded and dedicated workers.
Startup and later stalls use the same allowance. Roles without a worker use alwaysLive.
Synopsis
- data WorkerHeartbeat
- newWorkerHeartbeat :: IO WorkerHeartbeat
- newWorkerHeartbeatWithClock :: IO UTCTime -> IO WorkerHeartbeat
- recordPoll :: WorkerHeartbeat -> UTCTime -> IO ()
- lastPoll :: WorkerHeartbeat -> IO (Maybe UTCTime)
- workerJobStepAllowance :: NominalDiffTime
- workerHeartbeatStaleAfter :: NominalDiffTime
- heartbeatHealthy :: UTCTime -> UTCTime -> Maybe UTCTime -> Bool
- data Liveness = Liveness {}
- alwaysLive :: Liveness
- heartbeatLivenessNow :: WorkerHeartbeat -> IO Liveness
Documentation
data WorkerHeartbeat Source #
Worker progress and its startup allowance, separate from HTTP readiness.
newWorkerHeartbeat :: IO WorkerHeartbeat Source #
Build a fresh WorkerHeartbeat with no poll yet recorded (lastPoll is
Nothing until the worker's first successful receive).
newWorkerHeartbeatWithClock :: IO UTCTime -> IO WorkerHeartbeat Source #
Start the allowance at the supplied clock, which also drives liveness probes.
recordPoll :: WorkerHeartbeat -> UTCTime -> IO () Source #
Stamp the heartbeat with the given instant, recording a unit of worker progress.
The worker calls it through recordWorkerProgress.
lastPoll :: WorkerHeartbeat -> IO (Maybe UTCTime) Source #
The instant of the worker's last recorded progress, a successful poll or a completed
job, or Nothing before its first.
workerJobStepAllowance :: NominalDiffTime Source #
How long one long job step may run: uploading the largest artifact the memory plan admits (512 MiB) over a 2 MiB-per-second link. Renewing a receipt's visibility never extends it.
workerHeartbeatStaleAfter :: NominalDiffTime Source #
Startup and progress allowance: a fetch and a publish of that largest artifact plus a minute, so a slow job never restarts the process.
heartbeatHealthy :: UTCTime -> UTCTime -> Maybe UTCTime -> Bool Source #
Judge progress at now, using startup time only until the first successful progress.
What /livez answers from: the health verdict, plus the instant the checked loop last
recorded progress so an orchestrator can judge staleness rather than only pass or fail.
Constructors
| Liveness | |
Fields
| |
alwaysLive :: Liveness Source #
The verdict of a role with no background loop to stall: live, with nothing to report.
heartbeatLivenessNow :: WorkerHeartbeat -> IO Liveness Source #
Read the worker heartbeat and judge it against the current wall clock, keeping the
instant judged. Both the embedded and the dedicated worker answer /livez through this.