Mapper methods


2 Answer(s)


Hi Sonu,

They are called for each task, let say you have 50 mappers/reducer running, the setup / cleanup will be called for each one.

Yes, as I mention above.

This would be helpful. The setup/cleanup methods are used for initialization and clean up at task level. Within a task, first initialization happens with a single call to setup() method and then all calls to map() [or reduce()] function will be done. After that another single call will be made to cleanup() method before exiting the task.

One gotcha is the standard run method for both Mapper and Reducer does not catch exceptions around the map / reduce methods - so if an exception is thrown in these methods, the clean up method will not be called.

 

Hope this helps.

Thanks.


Thanks Abhijit.