ecluse:ecluse-core
Safe HaskellNone
LanguageGHC2021

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

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.

data Liveness Source #

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

Instances

Instances details
Show Liveness Source # 
Instance details

Defined in Ecluse.Core.Worker.Liveness

Eq Liveness Source # 
Instance details

Defined in Ecluse.Core.Worker.Liveness

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.