Return-Path: Delivered-To: apmail-hadoop-mapreduce-user-archive@minotaur.apache.org Received: (qmail 99559 invoked from network); 12 Nov 2009 08:17:05 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 12 Nov 2009 08:17:05 -0000 Received: (qmail 60195 invoked by uid 500); 12 Nov 2009 08:17:04 -0000 Delivered-To: apmail-hadoop-mapreduce-user-archive@hadoop.apache.org Received: (qmail 60136 invoked by uid 500); 12 Nov 2009 08:17:04 -0000 Mailing-List: contact mapreduce-user-help@hadoop.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: mapreduce-user@hadoop.apache.org Delivered-To: mailing list mapreduce-user@hadoop.apache.org Received: (qmail 60127 invoked by uid 99); 12 Nov 2009 08:17:03 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 12 Nov 2009 08:17:03 +0000 X-ASF-Spam-Status: No, hits=3.4 required=10.0 tests=HTML_MESSAGE,SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (nike.apache.org: local policy) Received: from [216.145.54.173] (HELO mrout3.yahoo.com) (216.145.54.173) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 12 Nov 2009 08:16:52 +0000 Received: from [192.168.1.71] (snvvpn2-10-73-152-c232.hq.corp.yahoo.com [10.73.152.232]) by mrout3.yahoo.com (8.13.6/8.13.6/y.out) with ESMTP id nAC8EQBF053914 for ; Thu, 12 Nov 2009 00:14:27 -0800 (PST) DomainKey-Signature: a=rsa-sha1; s=serpent; d=yahoo-inc.com; c=nofws; q=dns; h=message-id:from:to:in-reply-to:content-type:mime-version: subject:date:references:x-mailer; b=aQEg/xYEtFaJh2Qfnkqias0IOUZTdLYWHw/htvWEF1VU3dYqbwAWdcEMaWkXdWKo Message-Id: From: Arun C Murthy To: mapreduce-user@hadoop.apache.org In-Reply-To: <80576ef0911112228k24322a9dn9511ae55bf379dfa@mail.gmail.com> Content-Type: multipart/alternative; boundary=Apple-Mail-7-533592655 Mime-Version: 1.0 (Apple Message framework v936) Subject: Re: Can I wire a mapper and reducer class? Date: Thu, 12 Nov 2009 00:14:26 -0800 References: <80576ef0911112228k24322a9dn9511ae55bf379dfa@mail.gmail.com> X-Mailer: Apple Mail (2.936) X-Virus-Checked: Checked by ClamAV on apache.org --Apple-Mail-7-533592655 Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit You can't do that, at least not yet: https://issues.apache.org/jira/browse/MAPREDUCE-1183 Arun On Nov 11, 2009, at 10:28 PM, Java Developer wrote: > I want to know if I can "wire" mapper and reducer classes. By "wire" > I mean to use inversion of control (or dependency injection). For > example, I see in a lot of books and on the Map/Reduce tutorial page > (http://hadoop.apache.org/common/docs/r0.20.0/mapred_tutorial.html), > something like this: > > conf.setMapperClass(MyMapper.class); > conf.setReducerClass(MyReducer.class); > > However, I want do something like this: > > MyMapper mapper = new MyMapper(); > mapper.setSomeProperty("something"); > > MyReducer reducer = new MyReducer(); > reducer.setSomeProperty("somethingElse"); > > JobConf conf = new JobConf(); > conf.setMapper(mapper); > conf.setReducer(reducer); > > Is this possible? I'm still learning MapReduce so I don't know if > this is possible. But all examples that I have come across follow > the pattern on the tutorial page. There is a work around that I've > been forced to. In my mapper and reducer class, I can grab some > properties file and then fill in the values that I need (for example > for JDBC connection). I see the problem that when I run this on a > distributed environment, I'll need the properties files there as > well. Does the mapper and reducer classes have a reference back to > the JobConf object? If so, I suppose I can get the properties there. > > Thanks. --Apple-Mail-7-533592655 Content-Type: text/html; charset=US-ASCII Content-Transfer-Encoding: quoted-printable You can't do that, at least not = yet: https://issu= es.apache.org/jira/browse/MAPREDUCE-1183

Arun
=

On Nov 11, 2009, at 10:28 PM, Java Developer = wrote:

I want to know if I can "wire" mapper and reducer classes. = By "wire" I mean to use inversion of control (or dependency injection). = For example, I see in a lot of books and on the Map/Reduce tutorial page = (http://hadoop.apache.org/common/docs/r0.20.0/mapred_tutorial.html), = something like this:
=
conf.setMapperClass(MyMapper.class);
conf.setReducerClass(MyReducer= .class);

However, I want do something like this:

MyMapper = mapper =3D new MyMapper();
mapper.setSomeProperty("something");
=
MyReducer reducer =3D new = MyReducer();
reducer.setSomeProperty("somethingElse");

JobConf = conf =3D new = JobConf();
conf.setMapper(mapper);
conf.setReducer(reducer);

= Is this possible? I'm still learning MapReduce so I don't know if this = is possible. But all examples that I have come across follow the pattern = on the tutorial page. There is a work around that I've been forced to. = In my mapper and reducer class, I can grab some properties file and then = fill in the values that I need (for example for JDBC connection). I see = the problem that when I run this on a distributed environment, I'll need = the properties files there as well. Does the mapper and reducer classes = have a reference back to the JobConf object? If so, I suppose I can get = the properties there.
=
Thanks.

= --Apple-Mail-7-533592655--