[Twisted-Python] Implementing an event manager in twisted
glyph at divmod.com
glyph at divmod.com
Thu Apr 12 14:12:04 EDT 2007
On 12:26 am, daedalus at eigenmagic.com wrote:
>I have had an idea to implement an event manager to glue a few
>system components together, and I am wondering which pieces of twisted
>would be best suited to the task, or even if I should attempt it at
Nothing about what you're suggesting sounds dangerous or weird. In
fact, it really sounds like what Twisted is already :). If you want to
write a layer over it to provide higher-level events, that's fine; most
Twisted applications do something of the sort. The one thing I'd
caution you against is attempting to make something at the same level of
abstraction as Twisted by building on top of Twisted. That would just
add complexity and overhead without any benefit. So here are some
things you've described which sound, to me, exactly like what Twisted
>I have a desire to provide scheduler functionality (at time x, take
This sounds like reactor.callLater(). (Or if you're talking about
persistent scheduling, axiom's IScheduler.schedule).
>Data is received from an external entity by a listener.
This sounds like IProtocol's dataReceived method.
>A program polls for data, succeeds and notifies the event manager of
>data that was polled. The event manager notifies a 'poll storage'
>that stores the data in the database. It could also notify other
In python, "notifying things" is just calling functions or methods; in
the most advanced case, it's still just calling functions or methods
which have been placed into a list. Twisted has lots of such lists, and
it doesn't seem worthwhile to me to unify them into a central structure.
If it does make sense to you to unify them, you might want to look at
Louie: http://pylouie.org/ . I've never used it and I don't really get
what it's for, but several folks that I know seem to like it a lot for
gluing events together.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Twisted-Python