Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #105704
| Path | csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail |
|---|---|
| From | Ray Cote <rgacote@appropriatesolutions.com> |
| Newsgroups | comp.lang.python |
| Subject | Re: Adding run_in_executor task to already existing loop. |
| Date | Fri, 25 Mar 2016 17:06:06 -0400 |
| Lines | 27 |
| Message-ID | <mailman.10.1458939998.28225.python-list@python.org> (permalink) |
| References | <CAG5tnzpKOXfo4tz4tvF2aBsx0p5awGN4GhYN6wYn3kfY_ZQ0Bg@mail.gmail.com> <CAKJDb-OehiunT53Rqet9OmhigUwoBGVXchnmizz+weKRe0pakQ@mail.gmail.com> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=UTF-8 |
| Content-Transfer-Encoding | quoted-printable |
| X-Trace | news.uni-berlin.de 1g7P4xnBFztXqAGnPtOXtABYFf9OgMLuJ9ICJE1s2oVw== |
| Return-Path | <rgacote@appropriatesolutions.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.020 |
| X-Spam-Evidence | '*H*': 0.96; '*S*': 0.00; 'error:': 0.05; 'loop.': 0.09; 'def': 0.13; 'producing': 0.15; '2016': 0.16; 'async': 0.16; 'directive': 0.16; 'elsewhere,': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'subject:Adding': 0.16; 'subject:already': 0.16; 'wrote:': 0.16; 'email addr:gmail.com>': 0.18; 'assuming': 0.22; 'trying': 0.22; 'needed.': 0.23; 'this:': 0.23; 'header:In-Reply-To:1': 0.24; 'fri,': 0.27; 'message-id:@mail.gmail.com': 0.27; "i'm": 0.30; 'raymond': 0.30; 'running': 0.34; 'received:google.com': 0.35; 'received:209.85': 0.36; 'to:addr:python-list': 0.36; 'pm,': 0.36; 'subject:: ': 0.37; 'thanks': 0.37; 'received:209.85.213': 0.37; 'doing': 0.38; 'received:209': 0.38; 'skype:': 0.38; 'skip:p 20': 0.38; 'to:addr:python.org': 0.40; 'future': 0.60; 'your': 0.60; 'email:': 0.62; 'within': 0.64; 'mar': 0.65; 'results': 0.66; 'await': 0.76; 'ware': 0.91 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=appropriatesolutions.com; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to; bh=XBzWhtyzs1vJEvpA042etHVHbN+5Esqan4yjRXcON5c=; b=envmdRH50IDiJYpxrv/FfUR7+NcATLFhVG1ptWgCgPzbQC6GgCCMpYAT5ZBbIpqL1D 4dcFaxLlUIHXWEerfCPqHPsa7uQzSRp7qOCiIiJT2ygPWrJnvHvtzJivBJaZvWHIMPVQ tEtQ7Memx+wf9S/NpRVJrQ4cuyAW97lPgy5lI= |
| 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; bh=XBzWhtyzs1vJEvpA042etHVHbN+5Esqan4yjRXcON5c=; b=JFOIGpHV54XLdn953gd1t5lrp7VZDS/R8bMSYN3LeQ7yDF01ZE6op3dIe3Se3ZEio3 pg3LI88u74W35pBsaEjKcisqrAmHXGJInOL9GYvaIXWIBhnQX+/pA+p1IPW0FGrbZOPi +VS1JhU4dyTuZ2ypsB5SkoGVlcH8vPYIhBkv+8uVeSjAgoOyyq1nOn8VBDFIxaiO2Zg7 oRBL6t8hveE0PnrIi3q+SDVJd2DDgToXnrktCKXvmvrOA/yUfXTNebasezTTiN3S4au/ 3Wns73ymxz7pMnOVvQ5b773acPhLH8Mzpd6AbBKZzYFDHU1OHrPlGZJqinaMqU6iAJHz hwbQ== |
| X-Gm-Message-State | AD7BkJKk0vNCBKAAZ1fJLPYvMnQvcY7LLMeFnMZSY73DgGPvdfluJlUnrI/SsXzrJgiplHfjJ7HGDE373O3GKQ== |
| X-Received | by 10.159.35.49 with SMTP id 46mr7588123uae.32.1458939995830; Fri, 25 Mar 2016 14:06:35 -0700 (PDT) |
| In-Reply-To | <CAKJDb-OehiunT53Rqet9OmhigUwoBGVXchnmizz+weKRe0pakQ@mail.gmail.com> |
| X-Content-Filtered-By | Mailman/MimeDel 2.1.21 |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.21 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Xref | csiph.com comp.lang.python:105704 |
Show key headers only | View raw
On Fri, Mar 25, 2016 at 5:00 PM, Zachary Ware <zachary.ware+pylist@gmail.com > wrote: > I'm assuming you're doing `await process_request()` elsewhere, which > is what's producing your error: you're trying to start the loop within > a coroutine running on that loop. loop.run_in_executor() returns a > Future just like any other coroutine, so process_request just needs > this: > > async def process_request(): > loop = asyncio.get_event_loop() > results = await loop.run_in_executor(None, blocking_func, 'hello') > Yes, that was precisely the directive I needed. This is now working perfectly. Thanks —Ray -- Raymond Cote, President voice: +1.603.924.6079 email: rgacote@AppropriateSolutions.com skype: ray.cote
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: Adding run_in_executor task to already existing loop. Ray Cote <rgacote@appropriatesolutions.com> - 2016-03-25 17:06 -0400
csiph-web