t.i.t.Cooperator(object) : class documentation

Part of twisted.internet.task View Source View In Hierarchy

Cooperative task scheduler.
Method __init__ Create a scheduler-like object to which iterators may be added.
Method coiterate Add an iterator to the list of iterators this Cooperator is currently running.
Method cooperate Start running the given iterator as a long-running cooperative task, by calling next() on it as a periodic timed event.
Method start Begin scheduling steps.
Method stop Stop scheduling steps. Errback the completion Deferreds of all iterators which have been added and forget about them.
Method _addTask Add a CooperativeTask object to this Cooperator.
Method _removeTask Remove a CooperativeTask from this Cooperator.
Method _tasksWhileNotStopped Yield all CooperativeTask objects in a loop as long as this Cooperator's termination condition has not been met.
Method _tick Run one scheduler tick.
Method _reschedule Undocumented
def __init__(self, terminationPredicateFactory=_Timer, scheduler=_defaultScheduler, started=True): (source)
Create a scheduler-like object to which iterators may be added.
ParametersterminationPredicateFactoryA no-argument callable which will be invoked at the beginning of each step and should return a no-argument callable which will return False when the step should be terminated. The default factory is time-based and allows iterators to run for 1/100th of a second at a time.
schedulerA one-argument callable which takes a no-argument callable and should invoke it at some future point. This will be used to schedule each step of this Cooperator.
startedA boolean which indicates whether iterators should be stepped as soon as they are added, or if they will be queued up until Cooperator.start is called.
def coiterate(self, iterator, doneDeferred=None): (source)
Add an iterator to the list of iterators this Cooperator is currently running.
ParametersdoneDeferredIf specified, this will be the Deferred used as the completion deferred. It is suggested that you use the default, which creates a new Deferred for you.
Returnsa Deferred that will fire when the iterator finishes.
def cooperate(self, iterator): (source)
Start running the given iterator as a long-running cooperative task, by calling next() on it as a periodic timed event.
Parametersiteratorthe iterator to invoke.
Returnsa CooperativeTask object representing this task.
def _addTask(self, task): (source)
Add a CooperativeTask object to this Cooperator.
def _removeTask(self, task): (source)
Remove a CooperativeTask from this Cooperator.
def _tasksWhileNotStopped(self): (source)
Yield all CooperativeTask objects in a loop as long as this Cooperator's termination condition has not been met.
def _tick(self): (source)
Run one scheduler tick.
def _reschedule(self): (source)
Undocumented
def start(self): (source)
Begin scheduling steps.
def stop(self): (source)
Stop scheduling steps. Errback the completion Deferreds of all iterators which have been added and forget about them.
API Documentation for Twisted, generated by pydoctor at 2011-10-27 16:27:37.