Package flumotion :: Package common :: Module poller :: Class Poller
[hide private]

Class 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.

Instance Methods [hide private]
 
__init__(self, proc, timeout, immediately=False, start=True)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
source code
 
start(self, immediately=False)
Start the poller.
source code
 
_reschedule(self, immediately=False) source code
 
run(self)
Run the poller immediately, regardless of when it was last run.
source code
 
stop(self)
Stop the poller.
source code

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __str__

Inherited from extern.log.log.Loggable: __providedBy__, debug, doLog, error, info, log, logFunction, logObjectName, warning, warningFailure, writeMarker

Class Variables [hide private]

Inherited from extern.log.log.Loggable: __implemented__, __provides__, logCategory

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, proc, timeout, immediately=False, start=True)
(Constructor)

source code 

x.__init__(...) initializes x; see x.__class__.__doc__ for signature

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(self, immediately=False)

source code 

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(self)

source code 

Stop the poller.

This procedure ensures that the poller is stopped. It may be called multiple times.