hadoop-mapreduce-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Lewis John Mcgibbney <lewis.mcgibb...@gmail.com>
Subject How to Access a Mapper and Reducer Counters (cont'd???)
Date Tue, 30 Oct 2012 22:36:07 GMT
Hi All,

I am attempting to access the number of output records in a map task
and therefore turned to the o.a.h.mapreduce.Job#getCounters() API and
attempted to do something like this

String mapTaskOutputCounterName = MAP_OUTPUT_RECORDS;
...
Counters counter = currentJob.getCounters();
...
counter.getGroup(mapTaskOutputCounterName).size();

However this always gave me 0 when I attempted to push this value to
LOG output. I therefore searched on the list archives and came across
this rather interesting thread [0] which eventually leads to
MAPREDUCE-3520[1] highlighting the need for a new interface for
metrics to be exchanged between maps and reduces.

I need to be honest here and say that the integer value I am after is
rather trivial in its purpose (it compliments some simple logging
within Nutch 2.x) however it would be great if someone could provide
me with the code to obtain the correct counter group (e.g.
MAP_OUTPUT_RECORDS) from within the Job Counters.

Thank you very much in advance for any help which comes this way.

Lewis

[0] http://www.mail-archive.com/mapreduce-user@hadoop.apache.org/msg03724.html
[1] https://issues.apache.org/jira/browse/MAPREDUCE-3520

-- 
Lewis

Mime
View raw message