Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #101880 > unrolled thread

Re: parallel (concurrent) eventlet

Started byIan Kelly <ian.g.kelly@gmail.com>
First post2016-01-18 09:47 -0700
Last post2016-01-18 09:47 -0700
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: parallel (concurrent) eventlet Ian Kelly <ian.g.kelly@gmail.com> - 2016-01-18 09:47 -0700

#101880 — Re: parallel (concurrent) eventlet

FromIan Kelly <ian.g.kelly@gmail.com>
Date2016-01-18 09:47 -0700
SubjectRe: parallel (concurrent) eventlet
Message-ID<mailman.91.1453135930.15297.python-list@python.org>
On Mon, Jan 18, 2016 at 8:03 AM, David Gabriel <davidgab283@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

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web