l.s.t.t.ITaskSource(Interface) : interface documentation

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

A source of tasks to do.

This is passed to ITaskConsumer.consume as a source of tasks to do. Tasks are nullary callables that might return Deferreds.

Objects that provide this interface must call ITaskConsumer.noTasksFound if there are no tasks to generate, and call ITaskConsumer.taskStarted with the nullary callable whenever it generates a task.

Method start Start generating tasks.
Method stop Stop generating tasks.
def start(task_consumer):
Start generating tasks.

If start has already been called, then the given 'task_consumer' replaces the existing task accepter.

Parameterstask_consumerA provider of ITaskConsumer.
def stop():
Stop generating tasks.

It might not be possible to return instantly, so this method should return a Deferred with a boolean that indicates whether ITaskSource.start was called in the meantime.

Any subsequent calls to stop are silently ignored.

ReturnsA Deferred that will fire when the source is stopped. It is possible that tasks may be produced until this deferred fires. The deferred will fire with a boolean; True if the source is still stopped, False if the source has been restarted since stop() was called.
API Documentation for Launchpad, generated by pydoctor at 2022-06-16 00:00:12.