twisted :: internet :: task :: LoopingCall :: Class LoopingCall
[hide private]

Class LoopingCall

object --+
         |
        LoopingCall

Call a function repeatedly.

If f returns a deferred, rescheduling will not take place until the deferred has fired. The result value is ignored.

Instance Methods [hide private]
 
__call__(self)
 
__init__(self, f, *a, **kw)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
 
__repr__(self)
repr(x)
 
_reschedule(self)
Schedule the next iteration of this looping call.
 
start(self, interval, now=True)
Start running function every interval seconds.
 
stop(self)
Stop running function.

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

Class Variables [hide private]
  call = None
  deferred = None
  interval = None
  running = False
  starttime = None
Instance Variables [hide private]
float _lastTime = 0.0
The time at which this instance most recently scheduled itself to run.
  a
A tuple of arguments to pass the function.
  clock
A provider of twisted.internet.interfaces.IReactorTime.
  f
The function to call.
  kw
A dictionary of keyword arguments to pass to the function.
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, f, *a, **kw)
(Constructor)

 

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

Overrides: object.__init__
(inherited documentation)

__repr__(self)
(Representation operator)

 

repr(x)

Overrides: object.__repr__
(inherited documentation)

start(self, interval, now=True)

 

Start running function every interval seconds.

Parameters:
  • interval - The number of seconds between calls. May be less than one. Precision will depend on the underlying platform, the available hardware, and the load on the system.
  • now - If True, run this call right now. Otherwise, wait until the interval has elapsed before beginning.
Returns:
A Deferred whose callback will be invoked with self when self.stop is called, or whose errback will be invoked when the function raises an exception or returned a deferred that has its errback invoked.

Instance Variable Details [hide private]

clock

A provider of twisted.internet.interfaces.IReactorTime. The default is twisted.internet.reactor. Feel free to set this to something else, but it probably ought to be set *before* calling start.