Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: Israel Brewster Newsgroups: comp.lang.python Subject: Re: Bi-directional sub-process communication Date: Mon, 23 Nov 2015 15:27:39 -0900 Lines: 62 Message-ID: References: Mime-Version: 1.0 (Mac OS X Mail 9.1 \(3096.5\)) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable X-Trace: news.uni-berlin.de 3+kCvJsh58wljRl7R3blNwJ3vU3rzLKHDB1t61VljPVw== Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.015 X-Spam-Evidence: '*H*': 0.97; '*S*': 0.00; 'receives': 0.03; 'subject:skip:c 10': 0.07; 'cc:addr:python-list': 0.09; 'cherrypy': 0.09; 'concern:': 0.09; 'subject:process': 0.09; 'threads,': 0.09; '23,': 0.16; 'command;': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'slave': 0.16; 'subject:sub': 0.16; 'threads': 0.16; 'wrote:': 0.16; 'url:home': 0.18; '2015': 0.20; 'cc:2**0': 0.20; 'cc:addr:python.org': 0.20; 'trying': 0.22; 'cc:no real name:2**0': 0.22; 'seems': 0.23; 'header:In-Reply- To:1': 0.24; 'mon,': 0.24; 'requests': 0.25; 'skip:- 40': 0.25; 'sort': 0.25; 'said,': 0.27; 'locks': 0.29; 'queue': 0.29; 'objects': 0.29; 'url:mailman': 0.30; 'work.': 0.30; 'class': 0.33; 'url:python': 0.33; 'url:listinfo': 0.34; 'could': 0.35; 'nov': 0.35; 'but': 0.36; 'should': 0.36; 'there': 0.36; 'url:org': 0.36; '(and': 0.36; 'child': 0.36; 'pm,': 0.36; 'subject:: ': 0.37; 'received:10': 0.37; 'charset:us-ascii': 0.37; 'shared': 0.38; 'speak': 0.38; 'means': 0.39; 'enough': 0.39; 'subject:-': 0.39; 'url:mail': 0.40; 'still': 0.40; 'some': 0.40; 'header:Message-Id:1': 0.61; 'side': 0.62; 'per': 0.62; 'information': 0.63; 'between': 0.65; 'received:10.9': 0.66; 'reply': 0.68; 'received:12': 0.81; 'packet.': 0.84; 'shared,': 0.84; 'alaska': 0.91; 'dennis': 0.91; 'do:': 0.91 X-Warning: RFC compliance checks disabled due to whitelist X-Warning: Reverse-Path DNS check skipped due to whitelist X-Warning: Maximum message size check skipped due to whitelist X-Warning: Realtime Block Lists skipped due to whitelist X-Warning: System filters skipped due to whitelist X-Warning: Domain filters skipped due to whitelist X-Warning: User filters skipped due to whitelist X-Warning: Anti-Spam check skipped due to whitelist X-Whitelist: 2147483645 X-Envelope-From: israel@ravnalaska.net X-Envelope-To: wlfraed@ix.netcom.com In-Reply-To: X-Mailer: Apple Mail (2.3096.5) 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:99289 On Nov 23, 2015, at 3:05 PM, Dennis Lee Bieber = wrote: >=20 > On Mon, 23 Nov 2015 08:54:38 -0900, Israel Brewster = > declaimed the following: >=20 >> Concern: Since the master process is multi-threaded, it seems likely = enough that multiple threads on the master side would make requests at = the same time. I understand that the Queue class has locks that make >=20 > Multiple "master" threads, to me, means you do NOT have a = "master > process". But I do: the CherryPy "application", which has multiple threads - one = per request (and perhaps a few more) to be exact. It's these request = threads that generate the calls to the child process. >=20 > Let there be a Queue for EVERY LISTENER. >=20 > Send the Queue as part of the request packet. No luck: "RuntimeError: Queue objects should only be shared between = processes through inheritance" This IS a master process, with multiple threads, trying to communicate = with a child process. That said, with some modifications this sort of = approach could still work. ----------------------------------------------- Israel Brewster Systems Analyst II Ravn Alaska 5245 Airport Industrial Rd Fairbanks, AK 99709 (907) 450-7293 ----------------------------------------------- >=20 > Let the subthread reply to the queue that was provided via the = packet >=20 > Voila! No intermixing of "master/slave" interaction; each slave = only > replies to the master that sent it a command; each master only = receives > replies from slaves it has commanded. Slaves can still be shared, as = they > are given the information of which master they need to speak with. >=20 > =09 >=20 > --=20 > Wulfraed Dennis Lee Bieber AF6VN > wlfraed@ix.netcom.com HTTP://wlfraed.home.netcom.com/ >=20 > --=20 > https://mail.python.org/mailman/listinfo/python-list