tickers
The pod's periodic tickers, and how a periodic check reports failure.
Each ticker is a task on the pod's own event loop, not a thread running a loop of its own, so shutdown is a cancel rather than a stop-event plus a join that may not land.
Module
Functions
clear_periodic_failure
def clear_periodic_failure(log: logging.Logger, key: tuple[str, ...], msg: str) ‑> None:Log msg at INFO if the check for key had been failing.
Arguments
log: The logger of the module that owns the check.key: The process-scoped warn-once key for the check.msg: The recovery message.
warn_periodic_failure
def warn_periodic_failure(log: logging.Logger, key: tuple[str, ...], msg: str) ‑> None:Log a periodic check's failure at WARNING once, then at DEBUG.
Arguments
log: The logger of the module that owns the check.key: The process-scoped warn-once key for the check.msg: The failure message.
Classes
PeriodicTickers
class PeriodicTickers():The periodic tickers running on the pod's event loop.
Variables
tasks : list[asyncio.Task[None]]- The running tickers, in the order they were started.
Methods
start
def start( self, tick: Callable[[], Coroutine[Any, Any, Any]], interval_seconds: float, *, name: str, stop_on: tuple[type[BaseException], ...] = (),) ‑> None:Schedule one periodic ticker on the running event loop.
Scheduled on the pod's own loop, so there is deliberately no notebook handling here. A task created here runs on whichever loop the pod started on - in a notebook, the patched one - so there is nothing left to work around.
Arguments
tick: One pass of the periodic work.interval_seconds: Minimum delay between the start of consecutive ticks.name: Identifies this ticker in its log lines and task name.stop_on: Exceptions that should end this ticker rather than be logged and swallowed.
stop_all
async def stop_all(self) ‑> None:Cancel every ticker and wait for them to unwind.
Cancellation is immediate and cannot be missed, so there is nothing to time out against. A ticker that raises while unwinding is logged, so one bad ticker cannot stop the rest of shutdown.