Abstract base class for a runnable service.
User needs to override and implement the “do” method.
Raises an exception, interrupting the durrent do() call, and sleeping for backoff seconds.
Override this to do something in a loop.
Cleanup code goes here. This is called when a service is stopped.
Current backoff seconds, 0.0 if not in a backoff state
Call this instead of sleep, so the service can be interrupted
Max backoff time in seconds
Min backoff time in seconds
Sets a “nothing happened” flag. This will cause backoff to remain the same, even on success.
run(*, timeout=None, until=None, sleep=0.001)¶
Calls do in a loop.
timeout: stop calling do after secs until: lambda returns bool sleep: seconds
If an unhandled exception occurs, backoff sleep will occur.
The name of this runnable service, defaults to the class name
start(*, daemon=True, **kwargs)¶
Start a thread, kwargs are passed to run()
True if the service has been started and has not finished stopping
Stop the service, allowing any do() to complete first.
Set when you call stop(), causes the services to drop out.
Wait for the service to stop.
Wake up, if do was sleeping, and do things right away.