Reputation: 11
I want to get the id of each mapper and reducer task because I want to tag the output of these mappers and reducers according to the mapper and reducer id. How can I retrieve the ids of each?
Thanks
Upvotes: 1
Views: 2837
Reputation: 687
You can print taskId in map, setup etc. functions by utilizing following code.
context.getTaskAttemptID().getTaskID();
Upvotes: 4
Reputation: 386
you can do it using: org.apache.hadoop.mapreduce.MapContext::getTaskAttemptID().
Upvotes: 1