[openstack-dev] Asynchrounous programming: replace eventlet with asyncio

Sean Dague sean at dague.net
Wed Feb 5 21:07:01 UTC 2014


On 02/05/2014 09:44 PM, victor stinner wrote:
> Hi,
> 
> Thierry Carrez wrote:
>>> The problem is that the asyncio module was written for Python 3.3, whereas
>>> OpenStack is not fully Python 3 compatible (yet). To easy the transition I
>>> have ported asyncio on Python 2, it's the new Trollis project which
>>> supports Python 2.6-3.4:
>>>    https://bitbucket.org/enovance/trollius
>>
>> How much code from asyncio did you reuse ? How deep was the porting
>> effort ? Is the port maintainable as asyncio gets more bugfixes over time ?
> 
> Technically, Trollius is a branch of the Tulip project. I host the repository on Bitbucket, whereas Tulip is hosted at code.google.com. I use "hg merge" to retrieve last changes from Tulip into Trollius.
> 
> Differences between Trollius and Tulip show how much work has been done between Python 2.6 and 3.3 :-) Some examples:
> 
> - classes must inherit from object in Python 2.6 to be "new-style" classes (it's not more needed in Python 3),
> - "{}".format() must be replaced with "{0}".format(),
> - IOError/OSError exceptions have been reworked and now have specialized subclasses in Python 3.3 (I reimplemented them for Python 2.6),
> - etc.
> 
> But most of the code is still the same between Tulip and Trollius. In my opinion, the major difference is that Tulip uses "yield from" wheras Trollius uses "yield", which imply subtle differences in the module iteself. You may not notice them if you use Trollius, but the implementation is a little bit different because of that (differences are limited to the asyncio/tasks.py file).
> 
> I'm working actively on Tulip (asyncio). We are fixing last bugs before the release of Python 3.4, scheduled for March 16, 2014. So I track changes in Tulip and I will "port" them into Trollius.

First, very cool!

This is very promising work. It might be really interesting to figure
out if there was a smaller project inside of OpenStack that could be
test ported over to this (even as a stackforge project), and something
we could run in the gate.

Our experience is the OpenStack CI system catches bugs in libraries and
underlying components that no one else catches, and definitely getting
something running workloads hard on this might be helpful in maturing
Trollius. Basically coevolve it with a piece of OpenStack to know that
it can actually work on OpenStack and be a viable path forward.

	-Sean

-- 
Sean Dague
Samsung Research America
sean at dague.net / sean.dague at samsung.com
http://dague.net

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 482 bytes
Desc: OpenPGP digital signature
URL: <http://lists.openstack.org/pipermail/openstack-dev/attachments/20140206/bfa1776d/attachment.pgp>


More information about the OpenStack-dev mailing list