[Twisted-Python] eventlet 0.8.11 released; now with twisted support

Denis Bilenko denis.bilenko at gmail.com
Mon Jun 29 22:14:54 EDT 2009


Some of the changes from 0.8:

Eventlet can now run on top of twisted reactor. Twisted-based hub is
enabled automatically if
twisted.internet.reactor is imported. It is also possible to "embed"
eventlet into a twisted
application via eventlet.twistedutil.join_reactor. See the examples
for details.

http://bitbucket.org/denis/eventlet/src/tip/examples/

A new package, eventlet.twistedutil, is added that makes integration
of twisted and eventlet
easier. It has block_on function that allows to wait for a Deferred to
fire and it wraps
twisted's Protocol in a synchronous interface. This is similar to and
is inspired by Christopher
Armstrong's corotwine library. Thanks to Dan Pascu for reviewing the package.

Another new package, eventlet.green, was added to provide some of the
standard modules
that are fixed not to block other greenlets. This is an alternative to
monkey-patching
the socket, which is impossible to do if you are running twisted reactor.
The package includes socket, httplib, urllib2.

Much of the core functionality has been refactored and cleaned up,
including the removal
of eventlet.greenlib. This means that it is now possible to use plain
greenlets without
modification in eventlet, and the subclasses of greenlet instead of the old
eventlet.greenlib.GreenletContext. Calling
eventlet.api.get_hub().switch() now checks to
see whether the current greenlet has a "switch_out" method and calls
it if so, providing the
same functionality that the GreenletContext.swap_out used to. The
swap_in behavior can be
duplicated by overriding the switch method, and the finalize
functionality can be duplicated
by having a try: finally: block around the greenlet's main
implementation. The eventlet.backdoor
module has been ported to this new scheme, although it's signature had
to change slightly so
existing code that used the backdoor will have to be modified.

A number of bugs related to improper scheduling of switch calls has been fixed.
The fixed functions and classes include api.trampoline, api.sleep, coros.event,
coros.semaphore, coros.queue.

Many methods of greenio.GreenSocket were fixed to make its behavior
more like that of a regular
socket. Thanks to Marcin Bachry for fixing GreenSocket.dup to preserve
the timeout.

Added proc module which provides an easy way to subscribe to
coroutine's results. This makes
it easy to wait for a single greenlet or for a set of greenlets to complete.

wsgi.py now supports chunked transfer requests (patch by Mike Barton)

The following modules were deprecated or removed because they were broken:
hubs.nginx, hubs.libev, support.pycurls, support.twisteds, cancel
method of coros.event class

The following classes are still present but will be removed in the
future version:
- channel.channel (use coros.Channel)
- coros.CoroutinePool (use pool.Pool)

saranwrap.py now correctly closes the child process when the referring
object is deleted,
received some fixes to its detection of child process death, now
correctly deals with the in
keyword, and it is now possible to use coroutines in a non-blocking
fashion in the child process.

Time-based expiry added to db_pool.  This adds the ability to expire
connections both by idleness
and also by total time open.  There is also a connection timeout option.

A small bug in httpd's error method was fixed.

Python 2.3 is no longer supported.

A number of tests was added along with a script to run all of them for
all the configurations.
The script generates an html page with the results.

Thanks to Brian Brunswick for investigation of popen4 badness (eventlet.process)
Thanks to Marcus Cavanaugh for pointing out some coros.queue(0) bugs.

The twisted integration as well as many other improvements were funded
by AG Projects (http://ag-projects.com), thanks!




More information about the Twisted-Python mailing list