parallel (concurrent) eventlet

Ian Kelly ian.g.kelly at gmail.com
Mon Jan 18 11:47:54 EST 2016


On Mon, Jan 18, 2016 at 8:03 AM, David Gabriel <davidgab283 at gmail.com> wrote:
> Dears,
>
> Let me add one more detail: When I add these two lines to check whether my
> modules are monkey_patched or not I get *False* as a result.
> I think it is strange to get this result since I patched my modules at the
> beginning using: eventlet.monkey_patch() as detailed here
> <http://eventlet.net/doc/patching.html#import-green>.
>
> print "*****is_monkey_patched(ldap.syncrepl) : %s*****" %
> eventlet.patcher.is_monkey_patched('ldap.syncrepl')
> print "*****is_monkey_patched(ldap.ldapobject) : %s*****" %
> eventlet.patcher.is_monkey_patched('ldap.ldapobject')

In your code you monkey patched the standard library modules, not the
ldap modules, so I think it's unsurprising that these return False.

As to why the ldap modules are blocking, python-ldap uses the OpenLDAP
client which is written in C and thus using its own blocking socket
code rather than the Python socket module. I don't believe it is
possible to "green" that. Therefore I think your only option for
concurrency with python-ldap is threading. It is possible to use
threads in conjunction with eventlet; see
http://eventlet.net/doc/threading.html



More information about the Python-list mailing list