type Poller
source code
object --+
|
extern.log.log.Loggable --+
|
Poller
A class representing a cancellable, periodic call to a procedure,
which is robust in the face of exceptions raised by the procedure.
The poller will wait for a specified number of seconds between calls.
The time taken for the procedure to complete is not counted in the
timeout. If the procedure returns a deferred, rescheduling will be
performed after the deferred fires.
For example, if the timeout is 10 seconds and the procedure returns a
deferred which fires 5 seconds later, the next invocation of the
procedure will be performed 15 seconds after the previous invocation.
|
|
|
|
|
|
|
run(self)
Run the poller immediately, regardless of when it was last run. |
source code
|
|
|
|
Inherited from extern.log.log.Loggable :
__providedBy__ ,
__provides__ ,
debug ,
doLog ,
error ,
info ,
log ,
logFunction ,
logObjectName ,
warning ,
warningFailure ,
writeMarker
|
__init__(self,
proc,
timeout,
immediately=False,
start=True)
(Constructor)
| source code
|
- Parameters:
proc - a procedure of no arguments
timeout - float number of seconds to wait between calls
immediately - whether to immediately call proc, or to wait until one period has
passed
start - whether to start the poller (defaults to True)
- Overrides:
object.__init__
|
Start the poller.
This procedure is called during __init__, so it is normally not
necessary to call it. It will ensure that the poller is running, even
after a previous call to stop().
- Parameters:
immediately - whether to immediately invoke the poller, or to wait until one
period has passed
|
Stop the poller.
This procedure ensures that the poller is stopped. It may be called
multiple times.
|