Return-Path: Delivered-To: apmail-hadoop-common-user-archive@www.apache.org Received: (qmail 52836 invoked from network); 3 Jan 2010 04:16:31 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 3 Jan 2010 04:16:31 -0000 Received: (qmail 60987 invoked by uid 500); 3 Jan 2010 04:16:29 -0000 Delivered-To: apmail-hadoop-common-user-archive@hadoop.apache.org Received: (qmail 60904 invoked by uid 500); 3 Jan 2010 04:16:29 -0000 Mailing-List: contact common-user-help@hadoop.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: common-user@hadoop.apache.org Delivered-To: mailing list common-user@hadoop.apache.org Received: (qmail 60894 invoked by uid 99); 3 Jan 2010 04:16:28 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 03 Jan 2010 04:16:28 +0000 X-ASF-Spam-Status: No, hits=-4.0 required=10.0 tests=RCVD_IN_DNSWL_MED,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of matei@eecs.berkeley.edu designates 169.229.60.87 as permitted sender) Received: from [169.229.60.87] (HELO gateway0.EECS.Berkeley.EDU) (169.229.60.87) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 03 Jan 2010 04:16:19 +0000 Received: from [192.168.0.105] (CPE0001031c997b-CM0011aea1a790.cpe.net.cable.rogers.com [99.226.207.14]) (authenticated bits=0) by gateway0.EECS.Berkeley.EDU (8.14.4/8.13.5) with ESMTP id o034Ft0v015137 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NOT) for ; Sat, 2 Jan 2010 20:15:57 -0800 (PST) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Apple Message framework v1077) Subject: Re: Small doubt in MR From: Matei Zaharia In-Reply-To: Date: Sat, 2 Jan 2010 23:15:54 -0500 Content-Transfer-Encoding: quoted-printable Message-Id: References: <73d592f61001022004l41495303ne841c44ed51ab76d@mail.gmail.com> To: common-user@hadoop.apache.org X-Mailer: Apple Mail (2.1077) X-Virus-Checked: Checked by ClamAV on apache.org If you want the code to happen on only one machine, why not run it in = your driver program that submits the MapReduce job? You could also create a special input record that tells the mapper who = gets that record that it's the chosen one. However, note that that = mapper may be run multiple times due hardware failures. Matei On Jan 2, 2010, at 11:08 PM, Mark Kerzner wrote: > I think you need some kind of semaphore that you can turn on by the = first > reducer. For example, allocating a file in HDFS would work - if you = could > guarantee that it is an atomic operation (create-if-does-not-exist). >=20 > Mark >=20 > On Sat, Jan 2, 2010 at 10:04 PM, bharath v < > bharathvissapragada1990@gmail.com> wrote: >=20 >> Hi, >>=20 >> I want a particular "section of code" to run only in any "ONE" of the >> mappers . So I employed the following procedure. >>=20 >> Main-Class >> { >>=20 >> public boolean flag =3D true; >>=20 >> Map-Class >> { >> if(flag) >> { >>=20 >> flag=3Dfalse; >> /* section of code */ >> } >>=20 >>=20 >> } >>=20 >> I am running this code on in pseudo-distributed mode and its working = fine . >> I doubt whether this runs correctly in distributed mode because , = mappers >> on >> other systems have to notified of the changed "flag" .. Any Comments = ? If >> this is wrong , any suggestions on what method I must follow to = achieve >> this >> functionality in D-mode . >>=20 >> Thanks >>=20