Skip to main content

Module drain

Module drain 

Source
Expand description

Draining the worker on shutdown (SIGTERM): what happens when, decided apart from the agent so it is tested with plain instants (see archive/PROJECT.md, Worker lifecycle: drain).

  • The running attempts get until the termination grace period minus the drain’s terminate and report periods (DrainPeriods); whatever still runs then gets SIGTERM, SIGKILL after the terminate period, and ends interrupted (run again without using a retry). The report period is left for the results to reach the master before the pod is killed (B8). A second shutdown request moves the deadline to now.
  • Once nothing runs, the agent waits (at most ACK_WAIT, never past half the report period before the end of the grace period) for the master to acknowledge the last results, then deregisters, waiting for the master to take it until a quarter of the report period before the end, and ends: the rest is for exiting within the grace (B237). Without a master it ends at once (the journal keeps the results for the next start).

Structs§

Drain
A drain in progress.
DrainPeriods
How a drain’s time is split ([worker] termination_grace_period, drain_terminate_period, drain_report_period; the configuration checks that the last two fit in the first).

Enums§

DrainStep
What a draining agent does next.

Constants§

ACK_WAIT
How long a drained agent waits for the master to acknowledge the last results.