Reputation: 196
Is there any way to retrieve and print the number of reduce output records after running a hadoop job? I'm iteratively running a map-reduce and I want to stop when my previous reduce output count is same as current map output count.
Upvotes: 1
Views: 817
Reputation: 20969
Depending on your Hadoop version, the names can be different. But in general you can access your counters from the job object.
job.getCounters().findCounter("org.apache.hadoop.mapred.Task$Counter",
"REDUCE_OUTPUT_RECORDS").getValue();
Consult the WebUI to see what counters are defined in your job, change the names accordingly.
Upvotes: 1