host.repeat¶
Periodic background task runner for RemoteHost.
RepeatRunner owns the repeat-task lifecycle: starting named periodic coroutines, storing their results in a bounded deque, and cancelling them cleanly.
It is decoupled from SSH/telnet — it receives a run_cmds coroutine factory
so it can be tested with an AsyncMock without any real connection.
- class otto.host.repeat.RepeatRunner(run_cmds)¶
Bases:
objectRuns named periodic command tasks and stores their results.
Parameters¶
- run_cmds:
Async callable that accepts a
list[str] | strand returns aRunResult. Typically bound toHost.run.
-
start(name, cmds, interval, times=
-1, duration=datetime.timedelta(days=999999999, seconds=86399, microseconds=999999), until=datetime.datetime(9999, 12, 31, 23, 59, 59, 999999), on_result=None, max_history=1000)¶ Start a named periodic task. Raises if that name is already running.
- Return type:¶
None
- get_results(name)¶
Return a snapshot of stored results for a named repeat task.
- Return type:¶
list[tuple[datetime,list[CommandStatus]]]