Principle:SeldonIO Seldon core Periodic Task Scheduling
| Knowledge Sources | |
|---|---|
| Domains | Scheduling, Observability |
| Last Updated | 2026-02-13 14:00 GMT |
Overview
A simple interval-based scheduling mechanism that repeatedly executes an action at fixed time intervals.
Description
Periodic Task Scheduling is a fundamental pattern for background processes that need to execute an action (such as metrics collection or health checks) at regular intervals. The scheduler runs an immediate first execution followed by sleeping for the configured interval before each subsequent execution. This is a blocking, infinite-loop design intended for long-running daemon processes.
This pattern is preferred over cron-style scheduling when the action should execute continuously with a fixed delay between completions, and the process lifecycle is managed externally (e.g., by Kubernetes).
Usage
Use this principle for long-running background tasks that must execute a callback at regular intervals, such as periodic telemetry collection, cache invalidation, or status polling.
Theoretical Basis
The scheduling follows a simple infinite loop with fixed delay:
Pseudo-code Logic:
# Abstract algorithm description
def run_periodic(interval, action):
while True:
action()
sleep(interval)
This guarantees a minimum interval between the start of consecutive executions (not the end), meaning long-running actions may overlap with the intended schedule if they exceed the interval duration.