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

Thierry Carrez thierry at openstack.org
Wed Feb 5 11:48:00 UTC 2014


victor stinner 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 ?

> The Trollius API is the same than asyncio, the main difference is the syntax in coroutines: "yield from task" must be written "yield task", and "return value" must be written "raise Return(value)".

Could we use a helper library (like six) to have the same syntax in Py2
and Py3 ? Something like "from six.asyncio import yield_from,
return_task" and use those functions for py2/py3 compatible syntax ?

-- 
Thierry Carrez (ttx)



More information about the OpenStack-dev mailing list