Path: csiph.com!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: 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; 'essentially': 0.04; 'exit': 0.07; 'terminated': 0.07; 'subject:help': 0.07; 'backwards': 0.09; 'called.': 0.09; 'inherited': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'spawn': 0.09; 'subject:skip:m 10': 0.09; 'thread': 0.11; '2.7': 0.13; 'value.': 0.15; '+0900,': 0.16; 'boolean': 0.16; 'daemons': 0.16; 'exited.': 0.16; 'flag,': 0.16; 'hangs': 0.16; 'processes.': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'subprocess': 0.16; 'threading': 0.16; 'wed,': 0.16; 'module,': 0.17; 'creates': 0.18; 'equivalent': 0.20; 'sort': 0.21; 'trying': 0.21; 'stephen': 0.22; 'tells': 0.22; 'terminate': 0.22; 'creating': 0.26; 'leave': 0.26; 'header:X-Complaints-To:1': 0.28; 'initial': 0.28; 'parent': 0.29; "i'm": 0.29; '(and': 0.32; 'gets': 0.32; 'url:home': 0.33; 'problem': 0.33; 'to:addr:python- list': 0.33; "can't": 0.34; 'done': 0.34; 'nov': 0.35; 'received:org': 0.36; 'child': 0.36; 'two': 0.37; 'subject:: ': 0.38; 'some': 0.38; 'to:addr:python.org': 0.39; 'header:Received:5': 0.40; 'help': 0.40; 'your': 0.60; 'reverse': 0.65; 'life': 0.66; 'sounds': 0.71; 'heavy': 0.83; 'dennis': 0.91; 'step.': 0.91 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Dennis Lee Bieber Subject: Re: multiprocessing help Date: Tue, 06 Nov 2012 23:23:55 -0500 Organization: > Bestiaria Support Staff < References: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Gmane-NNTP-Posting-Host: adsl-76-253-101-16.dsl.klmzmi.sbcglobal.net X-Newsreader: Forte Agent 3.3/32.846 X-No-Archive: YES X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 48 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1352262240 news.xs4all.nl 6907 [2001:888:2000:d::a6]:43204 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:32866 On Wed, 7 Nov 2012 09:52:35 +0900, Stephen Bunn declaimed the following in gmane.comp.python.general: > I'm looking for some help with multiprocessing. Essentially what I'm > trying to do is the following: > > 1. create a main process that gets daemonized > 2. spawn two subprocess that live for the life of the daemon That sounds backwards to me (presuming daemonized /processes/ are equivalent to daemonized /threads/). In the threading module, a daemon thread hangs around until the parent non-daemon thread exits. From the 2.7 documentation of multiprocessing: -=-=-=- daemon The process’s daemon flag, a Boolean value. This must be set before start() is called. The initial value is inherited from the creating process. When a process exits, it attempts to terminate all of its daemonic child processes. Note that a daemonic process is not allowed to create child processes. Otherwise a daemonic process would leave its children orphaned if it gets terminated when its parent process exits. Additionally, these are not Unix daemons or services, they are normal processes that will be terminated (and not joined) if non-daemonic processes have exited. -=-=-=- Problem is, you can't reverse your scheme since, if the "step" two processes were the daemons, they would not be allowed to do > 3. each subprocess creates children that do heavy work and exit when > the work is done this step. The only reliable means is for all subprocesses to be looking for a signal of some sort which tells them to exit on their own part. -- Wulfraed Dennis Lee Bieber AF6VN wlfraed@ix.netcom.com HTTP://wlfraed.home.netcom.com/