hadoop-mapreduce-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joey Echeverria <j...@cloudera.com>
Subject Re: 7 of 487 New window Print all Can JobConf object be declared global and used in mapper and reducer class
Date Wed, 21 Sep 2011 15:20:22 GMT
The map and reduce functions are running a different JVM, so they
never ran the main() method. You can implement a configure(JobConf
job) method in your map and reduce classes which will be passed the
JobConf you used to launch the job.

-Joey

On Wed, Sep 21, 2011 at 9:36 AM, pranjal shrivastava
<brilliantpj@gmail.com> wrote:
>
> pranjal shrivastava to mapreduce-user.
> show details 9:12 AM (22 minutes ago)
> Hi
> I declared JobConf object static and globally in the main class and initialized it in
the main function.Since it is global and static to inner mapper and reducer classes ,I tried
to JobConf object in the mapper and reducer function.But on doing this I find JobConf object
to be null.Why is this happening .
>
> Code is like
> class wordcount{
> private static JobConf conf;
>
> //public static mapperclass{
>     //I try to access conf object here which comes to be null
>
> }
> //public static reducerclass{
> }
> public static void main(String args[]){
> conf=new JobConf(wordcount.class)
> //set mapper class
> //setreducer class
> //set job client
> //launch the mappers,reducers
> }
> }
>
> Whats going wrong?Why I am not able to access conf object in mapper.I need this for using
distributed cache files.
>
> Thank you
> Pranjal



--
Joseph Echeverria
Cloudera, Inc.
443.305.9434

Mime
View raw message