user381766
user381766

Reputation: 11

how to find the id of each map task?

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

Answers (2)

tolgabuyuktanir
tolgabuyuktanir

Reputation: 687

You can print taskId in map, setup etc. functions by utilizing following code.

context.getTaskAttemptID().getTaskID();

Upvotes: 4

user381928
user381928

Reputation: 386

you can do it using: org.apache.hadoop.mapreduce.MapContext::getTaskAttemptID().

Upvotes: 1

Related Questions