load_retry
Retry loading datasources the pod could not load.
A datasource that cannot be loaded is skipped rather than failing the pod (see
DatasourceManager.load_datasources). What stopped it loading is often outside
the pod's config: a network share that was not mounted, a folder that was moved
and then moved back. A config reload retries it, but nothing reloads when only
the machine is fixed. So each datasource still held as unloadable is retried on
the pod's periodic ticker with a bounded exponential backoff, and served once it
loads.
Classes
DatasourceLoadRetry
class DatasourceLoadRetry( *, load: Callable[[DatasourceContainerConfig], DatasourceContainer], pending: Callable[[], Mapping[str, DatasourceContainerConfig]], on_loaded: Callable[[dict[str, RetriedLoad]], Awaitable[None]], initial_delay_seconds: float = 60.0, max_delay_seconds: float = 1800.0, clock: Callable[[], float] = <built-in function monotonic>,):When to next try loading the pod's unloadable datasources.
Create a retry with nothing scheduled.
Arguments
load: Loads one datasource from its config, raising if it cannot. Run off the event loop.pending: The datasources the pod currently holds as unloadable, by name. Read on every tick rather than copied, so a config reload that loads, replaces or removes one is seen at once.on_loaded: Given the datasources a retry loaded, each with the config it was loaded from, makes the pod serve them.initial_delay_seconds: The wait before the first retry.max_delay_seconds: The cap on the wait between retries.clock: Monotonic time source, for tests.
Methods
tick
async def tick(self) ‑> None:Retry every unloadable datasource, if a retry is due.
The first tick to find a datasource unloadable schedules the first
retry; nothing is retried straight away, as the failure has only just
been reported. A datasource that loads is handed to on_loaded. While
any datasource is still held as unloadable afterwards, whether it
failed to load again or the pod could not serve it, the wait before the
next attempt doubles, up to the cap. A failure was logged and sent to
telemetry when it first happened, so a failed retry is logged at debug
only.
RetriedLoad
class RetriedLoad( config: ForwardRef('DatasourceContainerConfig'), container: ForwardRef('DatasourceContainer'),):A datasource that loaded on retry, with the config it was loaded from.
The config is carried so the pod can check it is still the one it holds: a config reload may replace it whilst other datasources are still loading.