From top of my head, you could set the flag to true based on some globally unique condition. Like some specific file name with start offset 0 - like part-00000, offset 0 (the actual file name could be a jobconf param).


Note that the condition should be repeatable - since tasks can get reexecuted.


Regards,
Mridul



bharath v wrote:
Hi,

I want a particular "section of code" to run only in any "ONE" of the
mappers . So I employed the following procedure.

Main-Class
{

        public boolean flag = true;

        Map-Class
       {
             if(flag)
            {

                flag=false;
               /* section of code */
            }


}

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 .

Thanks

Reply via email to