hadoop-mapreduce-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From web service <wbs...@gmail.com>
Subject Re: Passing Arguments to Map & Reducer using Job
Date Sun, 31 Jul 2011 01:18:13 GMT
I think you can set properties by
job.getConfiguration().set("property","value");
and replace the configure with the method setup();
http://hadoop.apache.org/common/docs/r0.20.1/api/org/apache/hadoop/mapreduce/Mapper.html#setup%28org.apache.hadoop.mapreduce.Mapper.Context%29


On Sat, Jul 30, 2011 at 9:32 AM, Narayanan K <knarayanan88@gmail.com> wrote:

> Hi
>
> I am using *Job *(
> http://hadoop.apache.org/common/docs/r0.20.1/api/org/apache/hadoop/mapreduce/Job.html)
> to submit a MR job on Hbase.
>
> I want to pass some values from my main() to Map and Reduce functions.
>
> I know how to do this using a JobConf client.
>
> *In Main*
>
> JobConf job = new JobConf(conf, MR.class);
> job.set("Key", Value);
>
> *In Mapper/Reducer Class*
>
> JobConf conf;
> public void configure(JobConf job)
> {
>   conf = job;
>   val = job.get("Key");
>  }
>
> I get the value in val variable that I had set in Main, in my
> reducer/mapper class using the above method.
>
> But I tried the same with Job class instead of JobConf. There isnt a set
> method for Job.
>
> How do I pass values to map/reduce classes using Job just like I was able
> to do using JobConf client?
>
> Thanks,
> Narayanan
>
>
>

Mime
View raw message