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


Groups > comp.lang.python > #57344

Re: Global Variable In Multiprocessing

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!xlned.com!feeder3.xlned.com!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <rosuav@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.038
X-Spam-Evidence '*H*': 0.93; '*S*': 0.00; 'python.': 0.02; 'newbie': 0.05; '23,': 0.16; 'already,': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'globals': 0.16; "module's": 0.16; 'mutable': 0.16; '(you': 0.16; 'wrote:': 0.18; 'variable': 0.18; 'wed,': 0.18; 'copied': 0.24; 'header:In-Reply-To:1': 0.27; 'idea': 0.28; 'message-id:@mail.gmail.com': 0.30; 'another.': 0.31; "they'll": 0.31; 'option': 0.32; "can't": 0.35; 'but': 0.35; 'received:google.com': 0.35; 'right?': 0.36; 'doing': 0.36; 'depends': 0.38; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'to:addr:python.org': 0.39; 'read': 0.60; 'tips': 0.61; "you're": 0.61; 'information': 0.63; 'transfer': 0.82; 'examples.': 0.84; 'subject:skip:M 10': 0.84; 'subject:Global': 0.91; '2013': 0.98
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:to :content-type; bh=PwSaSR9F/VZtAHx+EgKYcSklpCHCojfOgSDuzSig3d8=; b=rfjaJAJQQfEDEmpwosT5kM9SUWxtDtlX6Fu90Uzy30FexNCb5YD4AUCtB+4nwfwD60 g3flCrWCzkVkJcJHbiNzAOms6bwID04vvwX9K4EChnq5k4Df3MevQd0NThpZQi0K3kkL eC69sc8xFYir5Prp3vpRtxufWAtgGpEz3w8jBgMzFtQTcE0qYXoOhOdrUdehxcY4+gqq ZFxBk9hGIwlHa9q8qjm47HaoucNgPpaLpQbEwMmFlKBikyRVdyISCgJYmoWXtxiNdmbh mltWGWgL9ppYyFo9u7G+hjPesD4TEpuPZYXbsNy7kYOyyzMcjstoroFi/tO8/JgQde2/ 2k0g==
MIME-Version 1.0
X-Received by 10.68.182.3 with SMTP id ea3mr62038pbc.124.1382510679465; Tue, 22 Oct 2013 23:44:39 -0700 (PDT)
In-Reply-To <F9D8DC52CB96E24D8C7AA5F8E9781E881E3DBFEE@BLRKECMBX23.ad.infosys.com>
References <F9D8DC52CB96E24D8C7AA5F8E9781E881E3DBFEE@BLRKECMBX23.ad.infosys.com>
Date Wed, 23 Oct 2013 17:44:39 +1100
Subject Re: Global Variable In Multiprocessing
From Chris Angelico <rosuav@gmail.com>
To python-list@python.org
Content-Type text/plain; charset=ISO-8859-1
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
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>
Newsgroups comp.lang.python
Message-ID <mailman.1397.1382510683.18130.python-list@python.org> (permalink)
Lines 14
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1382510683 news.xs4all.nl 15896 [2001:888:2000:d::a6]:47923
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:57344

Show key headers only | View raw


On Wed, Oct 23, 2013 at 5:22 PM, Chandru Rajendran
<Chandru_Rajendran@infosys.com> wrote:
>
> I am newbie to python. Please give me an idea to use Global Variable In multiprocessing with examples. Also give me an best practices of multiprocessing.

Fundamentally, you can't have mutable globals in multiprocessing
(though you can have immutables - they'll get copied into each
subprocess). Instead, look into the various data structures like the
queue, which can transfer information from one process to another. The
best option depends a lot on what you're doing - but you can find some
tips and ideas in the multiprocessing module's documentation. (You
HAVE read the docs already, right? :) )

ChrisA

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


Thread

Re: Global Variable In Multiprocessing Chris Angelico <rosuav@gmail.com> - 2013-10-23 17:44 +1100

csiph-web