You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-user@hadoop.apache.org by maha <ma...@umail.ucsb.edu> on 2010/12/31 02:28:15 UTC

Flow of control

Hi,

  (1) I declared a global variable in my hadoop mainClass which gets initialized in the 'run' function of this mainClass. When I try to access this global static variable from the MapperClass, it appears to be uninitialized. 

        Why is that? Is it because of the parallel execution of Hadoop functions ? but , isn't the 'run' function supposed to be the one to run first and prepare all the job configurations before the Maps even start?

  (2) Fig 4.5 in http://developer.yahoo.com/hadoop/tutorial/module4.html  shows the inputFormat to be the one running before the maps. My question is in which node? The JobTracker node?

  Thank you,
      Maha

Re: Flow of control

Posted by maha <ma...@umail.ucsb.edu>.
Very helpful :) thanks Ping.

Maha

On Dec 30, 2010, at 6:13 PM, li ping wrote:

> On Fri, Dec 31, 2010 at 9:28 AM, maha <ma...@umail.ucsb.edu> wrote:
> 
>> Hi,
>> 
>> (1) I declared a global variable in my hadoop mainClass which gets
>> initialized in the 'run' function of this mainClass. When I try to access
>> this global static variable from the MapperClass, it appears to be
>> uninitialized.
>> 
>>       Why is that? Is it because of the parallel execution of Hadoop
>> functions ? but , isn't the 'run' function supposed to be the one to run
>> first and prepare all the job configurations before the Maps even start?
>> 
> The Mapper will run on a remote machine, in other JVM, so the variable you
> set in Main class can not be shared with other VM.
> 
>> 
>> (2) Fig 4.5 in http://developer.yahoo.com/hadoop/tutorial/module4.html shows the inputFormat to be the one running before the maps. My question is
>> in which node? The JobTracker node?
>> I think it should run on JobTracker, The inputFormat will split the file
>> and the map function will read the every splited file.
>> Thank you,
>>      Maha
> 
> 
> 
> 
> -- 
> -----李平


Re: Flow of control

Posted by li ping <li...@gmail.com>.
On Fri, Dec 31, 2010 at 9:28 AM, maha <ma...@umail.ucsb.edu> wrote:

> Hi,
>
>  (1) I declared a global variable in my hadoop mainClass which gets
> initialized in the 'run' function of this mainClass. When I try to access
> this global static variable from the MapperClass, it appears to be
> uninitialized.
>
>        Why is that? Is it because of the parallel execution of Hadoop
> functions ? but , isn't the 'run' function supposed to be the one to run
> first and prepare all the job configurations before the Maps even start?
>
The Mapper will run on a remote machine, in other JVM, so the variable you
set in Main class can not be shared with other VM.

>
>  (2) Fig 4.5 in http://developer.yahoo.com/hadoop/tutorial/module4.html shows the inputFormat to be the one running before the maps. My question is
> in which node? The JobTracker node?
> I think it should run on JobTracker, The inputFormat will split the file
> and the map function will read the every splited file.
>  Thank you,
>       Maha




-- 
-----李平