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


Groups > comp.lang.python > #98068

Re: PyPy subprocess

Path csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail
From Chris Angelico <rosuav@gmail.com>
Newsgroups comp.lang.python
Subject Re: PyPy subprocess
Date Mon, 2 Nov 2015 09:11:55 +1100
Lines 24
Message-ID <mailman.38.1446415923.4463.python-list@python.org> (permalink)
References <37cd1025-2b18-48bf-a3cc-e792cce11b58@googlegroups.com>
Mime-Version 1.0
Content-Type text/plain; charset=UTF-8
X-Trace news.uni-berlin.de ssqDxynKEQYAj6yFzMNOTwdpAq/rEYLlD/k9qY9+W6/Q==
Return-Path <rosuav@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.000
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'received:209.85.223': 0.03; 'cpython': 0.05; 'json': 0.05; 'pypy': 0.07; 'cc:addr :python-list': 0.09; 'stdout': 0.09; 'that).': 0.09; 'python': 0.10; '2.7': 0.13; '"python': 0.16; 'finish.': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'invoking': 0.16; 'python-based': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'solver': 0.16; 'subject:PyPy': 0.16; 'subprocess': 0.16; 'utterly': 0.16; 'wrote:': 0.16; 'shipped': 0.18; 'language': 0.19; 'all,': 0.20; 'versions': 0.20; '2015': 0.20; 'cc:2**0': 0.20; 'cc:addr:python.org': 0.20; 'python"': 0.22; 'pass': 0.22; 'am,': 0.23; 'written': 0.24; 'header:In- Reply-To:1': 0.24; 'mon,': 0.24; 'wondering': 0.25; 'module': 0.25; 'script': 0.25; 'figure': 0.27; 'parameters': 0.27; 'message-id:@mail.gmail.com': 0.27; 'actual': 0.28; '(maybe': 0.29; 'command-line': 0.29; 'that.': 0.30; 'getting': 0.33; 'info': 0.34; 'received:google.com': 0.35; 'could': 0.35; 'newer': 0.35; 'nov': 0.35; 'something': 0.35; 'but': 0.36; 'there': 0.36; 'received:209.85': 0.36; 'subject:: ': 0.37; 'doing': 0.38; 'version': 0.38; 'received:209': 0.38; 'takes': 0.39; 'where': 0.40; 'some': 0.40; "you'll": 0.61; 'telling': 0.61; 'back': 0.62; 'complete': 0.63; 'overall': 0.72; 'chrisa': 0.84; 'to:none': 0.91; 'care,': 0.91; 'processes,': 0.93
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=PJ76l+pKgBnMbkbtx+fIOmMXomgs75CBHC4MNS10ay4=; b=M/9uik2UHHVEEnkL0AQnGaKt7N3t2uQe/vn5Q9uX+7GdBYC+S7c49pQ3t6ZQBA7CRx PaNtpdrbXkEFru7gOHXgvWGJQbmgrpShi/iTO6F8DLViSfFSyTXuPMVFr4uVP81Hi7CW g53uE79/HryQbT9OYUSYzkRuMrRtsWjLi3j+w9U3tKlAvRBPkQO2246ea8iR7gyA0S2O dbgX7F1DZfYRlsuSbUYs/VfTZ1hNjgczljbyefXE7LWaB4uG5p9KFRJa1BFPpD9i+ap8 WXNF9QEHtdu5lxooJwahDdtdyaPXC4A6wWawASQ2DmZgeBJV/FlPuGVaiztnjalEGmND gGQA==
X-Received by 10.107.137.167 with SMTP id t39mr18386949ioi.19.1446415915909; Sun, 01 Nov 2015 14:11:55 -0800 (PST)
In-Reply-To <37cd1025-2b18-48bf-a3cc-e792cce11b58@googlegroups.com>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.20+
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:98068

Show key headers only | View raw


On Mon, Nov 2, 2015 at 8:27 AM, LJ <luisjosenovoa@gmail.com> wrote:
> Im wondering if there is a way in which I can use PyPy to solve the just subproblems in parallel, and return to CPython for the overall routines.
>

You could. What you'd have would be a setup where the subprocess is
utterly independent of the parent; the fact that they both happen to
be written in Python is almost immaterial. Figure out some way of
telling the subprocess what it needs to do (eg command-line parameters
coming through into sys.argv), and getting a response back (eg writing
something to stdout before terminating), and then you can use the
subprocess module to spin off the pypy processes, then (maybe after
doing some other work) wait for each of them to finish.

The subproblem solver could be written in any language at all, here;
there's complete decoupling. If you need to pass a lot of info down
into them, or up and out again, you'll need to serialize it all into
JSON and use stdin/stdout, or something like that. Takes some care,
but it works beautifully... I once had a "Python in Python" setup like
that to make my Python-based web site trigger something in a newer
version of Python than was shipped with my OS (think of a 2.7 invoking
a 3.5 script - I don't remember the actual versions but it was
something like that).

ChrisA

Back to comp.lang.python | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

PyPy subprocess LJ <luisjosenovoa@gmail.com> - 2015-11-01 13:27 -0800
  PyPy subprocess LJ <luisjosenovoa@gmail.com> - 2015-11-01 13:29 -0800
  Re: PyPy subprocess Chris Angelico <rosuav@gmail.com> - 2015-11-02 09:11 +1100

csiph-web