Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: Ian Kelly Newsgroups: comp.lang.python Subject: Re: parallel (concurrent) eventlet Date: Mon, 18 Jan 2016 09:47:54 -0700 Lines: 24 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: news.uni-berlin.de q9EGiQWFgWdttfe4QzCQtQ/Rr0AhAgTz3ALlCD+HXGlg== Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.007 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'skip:e 50': 0.05; 'false.': 0.07; 'socket': 0.07; 'python': 0.10; '<>.': 0.11; 'jan': 0.11; 'result.': 0.15; '2016': 0.16; 'concurrency': 0.16; 'modules,': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'threads': 0.16; 'wrote:': 0.16; 'conjunction': 0.18; 'library': 0.20; 'skip:" 30': 0.20; 'skip:" 40': 0.20; 'am,': 0.23; 'thus': 0.24; 'written': 0.24; 'header:In-Reply-To:1': 0.24; 'mon,': 0.24; 'message-id:@mail.gmail.com': 0.27; 'module.': 0.27; 'blocking': 0.29; 'received:209.85.213.174': 0.29; 'print': 0.30; 'that.': 0.30; 'code': 0.30; 'option': 0.31; 'subject:) ': 0.32; 'add': 0.34; 'received:google.com': 0.35; 'lines': 0.36; 'received:209.85': 0.36; 'possible': 0.36; 'beginning': 0.36; 'modules': 0.36; 'to:addr:python-list': 0.36; 'subject:: ': 0.37; 'two': 0.37; 'client': 0.37; 'received:209.85.213': 0.37; 'received:209': 0.38; 'why': 0.39; 'rather': 0.39; 'skip:e 20': 0.39; 'to:addr:python.org': 0.40; 'your': 0.60; 'strange': 0.63; 'more': 0.63; 'believe': 0.66; 'here': 0.66; 'therefore': 0.67; 'gabriel': 0.84; 'to:name:python': 0.84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=IWomGdyClxfWoSMJKcjV7iC0BwP8FAhp1zT+RcBgB6E=; b=O5gPDSlps3KliL/c/QZAfzVGuS42O/X1FIkZ6PAcpv2gzsdyt9zf2Ik3VuCbUpKums +wiqrx/9BcpO2wIUzjd0b3+6N4qtw15nLgaJbJ/NtGwobJeiQFDa8Q5FIOEYHgmCjCov lE4TNVmENsoRvn2uKcxPcr3qUedf2pm2k3WAO4KN7Rc0/sP7p0MvHaqUtjwtDWIBotM4 wwRZaDzsus4YOfE+YAW7SwK2TEE0zFiwU4+kie3+KC03Y4JbWwLh/lgTvwR8twJbADBA kASVdSn+B6S7ci2iNNKWOde5KGarhV85jTuqI1mAfYNF7NO6iw4CsrNJMtWEZnXsBqnw dilA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:content-type; bh=IWomGdyClxfWoSMJKcjV7iC0BwP8FAhp1zT+RcBgB6E=; b=It++DrJ94NEZkwsMVpbsgRWhl1BuErSf7wysf7sJtX6mNpPHI8T2bMOrmDeOPxpSO2 ZLs6tvPCS7OsH0yj4/DGf/hxz3GRLrYBYv4loOFemlL4LVrLj9CwVeaTkZGq2d5/I/b6 VWz5jCpd3W5LEAU5Y20xOq8QwwJ6iY7FAMO9Wwqg7WgJ2uzPbtrTcrJJl1CtAQFjx95A NJEn8b3fV6B8BJXC+VuxnYX9hJGEGr53AgvwcfGK27/a+xbwLdhAmeSrmTFHTDXZoJOL hQvkAAac+Aus47G3h6N+2fIGsPRfeBrIfT3xNz6iIpHVdnbqLGCDqgC9zQSOJh2OGqVp J8UQ== X-Gm-Message-State: AG10YOSSAPgo1lKNUAGaNa04E35YqeBAhOH0aR29zU1n71LN+hJOgivj2kzWmpE2Q+yc+Wu4OiI9zHv6FUNdDA== X-Received: by 10.50.102.40 with SMTP id fl8mr11697159igb.85.1453135714002; Mon, 18 Jan 2016 08:48:34 -0800 (PST) In-Reply-To: X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.20+ Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Xref: csiph.com comp.lang.python:101880 On Mon, Jan 18, 2016 at 8:03 AM, David Gabriel 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 > . > > 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