[PEAK] peak events tasks...
john at landahl.org
Wed Jul 7 16:35:38 EDT 2004
On Wednesday 07 July 2004 09:36 am, darryl wrote:
> Does anyone have example code or publicly visible projects which use
> peak events etc. especially with respect to twisted support?
I used peak.events pretty extensively with Twisted while developing the
PEAK-based app at my previous job. The code to that application was supposed
to be open-sourced at some point, but unfortunately that's looking pretty
unlikely at this point.
I'm more than happy to share my experiences with peak.events "in the field",
though. Perhaps I can come up with a draft tutorial and you can let me know
if it answers your questions.
There are at least two major problems I encountered with Twisted and
peak.events, however. One is due to the fact that Twisted's reactors are
singletons meant to be started up and shutdown once. This makes it
impossible to use a peak.events "event loop" for "synchronizing" a call to a
Twisted asynchronous routine. This is needed when using Twisted behind the
scenes within an otherwise synchronous framework such as peak.storage (e.g.
when writing a DM which uses Perspective Broker as a way to move data between
a middle and client tier in an n-tier application).
The other problem is that Twisted reactors don't allow (direct) calls from
secondary threads, which makes it difficult to use another thread as a way of
getting around the first problem. One must write code to use
reactor.callFromThread, which may not even work for all use cases.
Note that these are limitations with Twisted caused by its insistence on
purely asynchronous applications. Without some improvements on the Twisted
side, there's only so much peak.events can do to provide a (seemingly)
synchronous layer above Twisted's reactors.
Anyway, we can chat about peak.events on #peak any time you like.
More information about the PEAK