Class: cogen.core.events.TimedOperation
Operations that have a timeout derive from this.
Eg:
yield TimedOperation( timeout=None, weak_timeout=True, prio=priority.DEFAULT )
- timeout - can be a float/int (number of seconds) or a timedelta or a datetime value if it's a datetime the timeout will occur on that moment
- weak_timeout - strong timeouts just happen when specified, weak_timeouts get delayed if some action happens (eg: new but not enough data recieved)
See: Operation. Note: you don't really use this, this is for subclassing for other operations.
Constructor
__init__ (self, timeout=None, weak_timeout=True, **kws)
Methods
cleanup (self, sched, coro)
Clean up after a timeout. Implemented in ops that need cleanup. If return value evaluated to false the sched won't raise the timeout in the coroutine.
finalize (self)
Called just before the Coroutine wrapper passes the operation back in the generator. Return value is the value actualy sent in the generator. Subclasses might overwrite this method and call it from the superclass.
process (self, sched, coro)
Add the timeout in the scheduler, check for defaults.
set_timeout (self, val)
Attributes
coro
Value of coro
<member 'coro' of 'TimedOperation' objects>
delta
Value of delta
<member 'delta' of 'TimedOperation' objects>
last_checkpoint
Value of last_checkpoint
<member 'last_checkpoint' of 'TimedOperation' objects>
prio
Value of prio
<member 'prio' of 'Operation' objects>
state
Value of state
<member 'state' of 'Operation' objects>
timeout
Value of timeout
<member 'timeout' of 'TimedOperation' objects>
weak_timeout
Value of weak_timeout
<member 'weak_timeout' of 'TimedOperation' objects>