Part of lp.services.twistedsupport.task View In Hierarchy
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'. |
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
.
Parameters | interval | The length of time between polls in seconds. |
task_producer | The polling mechanism. This is a nullary callable that can return a Deferred. See above for more details. | |
clock | An IReactorTime implementation that we use to manage
the interval-based polling. Defaults to using the reactor (i.e.
actual time). |