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


Groups > comp.lang.python > #26342

Re: Pass data to a subprocess

Path csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!feeder2.ecngs.de!ecngs!feeder.ecngs.de!xlned.com!feeder1.xlned.com!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <gandalf@shopzeus.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.025
X-Spam-Evidence '*H*': 0.95; '*S*': 0.00; 'unix,': 0.09; 'url:github': 0.09; 'cc:addr:python-list': 0.10; 'anyway': 0.11; ':-)': 0.13; 'daemons': 0.16; 'forks.': 0.16; 'subprocess': 0.16; 'test.': 0.17; 'thanks,': 0.18; 'code,': 0.18; 'cc:2**0': 0.23; 'cc:no real name:2**0': 0.24; 'idea': 0.24; 'cc:addr:python.org': 0.25; 'header:In-Reply-To:1': 0.25; 'header:User-Agent:1': 0.26; 'skip:m 30': 0.26; "doesn't": 0.28; 'actual': 0.28; "i'm": 0.29; 'that.': 0.30; 'running': 0.32; 'could': 0.32; 'done,': 0.33; 'mixed': 0.33; 'subject:data': 0.33; 'another': 0.33; 'wrong': 0.34; 'similar': 0.35; 'there': 0.35; 'really': 0.36; 'but': 0.36; 'anything': 0.36; 'should': 0.36; 'does': 0.37; 'uses': 0.37; 'far': 0.37; 'data': 0.37; 'subject:: ': 0.38; 'sure': 0.38; 'received:192': 0.39; 'received:192.168': 0.40; 'your': 0.60; 'share': 0.61; 'between': 0.63; 'production': 0.63; 'received:204': 0.72; 'killing': 0.84
Date Wed, 01 Aug 2012 12:16:53 +0200
From Laszlo Nagy <gandalf@shopzeus.com>
User-Agent Mozilla/5.0 (X11; Linux x86_64; rv:14.0) Gecko/20120714 Thunderbird/14.0
MIME-Version 1.0
To andrea crotti <andrea.crotti.0@gmail.com>
Subject Re: Pass data to a subprocess
References <CAF_E5JY5FgEJub7tNNzZEj0tri8Z7oPZUSLOLtD+5f0t7Yv+Yg@mail.gmail.com> <CAF_E5JY2sEsauXM-teW4hTHePqFCYK6z+9oLMZcjVWFyYs+gKg@mail.gmail.com> <5017EFB0.6080608@shopzeus.com> <CAF_E5JaEHxsjKoHRhZLzh+YdPU8UqKHae9efCsP7zEvm_37+2w@mail.gmail.com> <5018E687.9000105@shopzeus.com> <CAF_E5Jb83D6Uk-HG0sq5urTfxh6z9_fw+RR2ZEmesWTjEFR4-A@mail.gmail.com>
In-Reply-To <CAF_E5Jb83D6Uk-HG0sq5urTfxh6z9_fw+RR2ZEmesWTjEFR4-A@mail.gmail.com>
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 7bit
Cc python-list@python.org
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://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 <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.2813.1343816220.4697.python-list@python.org> (permalink)
Lines 22
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1343816220 news.xs4all.nl 6949 [2001:888:2000:d::a6]:57451
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:26342

Show key headers only | View raw


>
> Thanks, there is another thing which is able to interact with running
> processes in theory:
> https://github.com/lmacken/pyrasite
>
> I don't know though if it's a good idea to use a similar approach for
> production code, as far as I understood it uses gdb..  In theory
> though I could be able to set up every subprocess with all the data
> they need, so I might not even need to share data between them.
>
> Anyway now I had another idea to avoid to be able to stop the main
> process without killing the subprocesses, using multiple forks.  Does
> the following makes sense?  I don't really need these subprocesses to
> be daemons since they should quit when done, but is there anything
> that can go wrong with this approach?
On thing is sure: os.fork() doesn't work under Microsoft Windows. Under 
Unix, I'm not sure if os.fork() can be mixed with 
multiprocessing.Process.start(). I could not find official documentation 
on that.  This must be tested on your actual platform. And don't forget 
to use Queue.get() in your test. :-)

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


Thread

Re: Pass data to a subprocess Laszlo Nagy <gandalf@shopzeus.com> - 2012-08-01 12:16 +0200

csiph-web