l.s.t.t.PollingTaskSource : class documentation

Part of lp.services.twistedsupport.task View In Hierarchy

A task source that polls to generate tasks.

This is useful for systems where we need to poll a central server in order to find new work to do.

Method __init__ Construct a PollingTaskSource.
Method start See ITaskSource.
Method stop See ITaskSource.
Method _log_state Undocumented
Method _clear_looping_call Stop the looping call, and log about it.
Method _poll Poll for tasks, passing them to 'task_consumer'.
def __init__(self, interval, task_producer, clock=None, logger=None):
Construct a PollingTaskSource.

Polls 'task_producer' every 'interval' seconds. 'task_producer' returns either None if there's no work to do right now, or some representation of the task which is passed to the 'task_consumer' callable given to start. 'task_producer' can also return a Deferred.

ParametersintervalThe length of time between polls in seconds.
task_producerThe polling mechanism. This is a nullary callable that can return a Deferred. See above for more details.
clockAn IReactorTime implementation that we use to manage the interval-based polling. Defaults to using the reactor (i.e. actual time).
def _log_state(self, method_name, extra=''):
Undocumented
def start(self, task_consumer):
See ITaskSource.
def _clear_looping_call(self, reason):
Stop the looping call, and log about it.
def _poll(self, task_consumer):
Poll for tasks, passing them to 'task_consumer'.
def stop(self):
See ITaskSource.
API Documentation for Launchpad, generated by pydoctor at 2018-08-21 00:00:07.