return RepeatStatus.FINISHED;
}
@SuppressWarnings("deprecation")
private void saveCounters(Job job, StepContribution contribution) {
Counters counters = null;
try {
counters = job.getCounters();
} catch (Exception ex) {
if (RuntimeException.class.isAssignableFrom(ex.getClass())) {
throw (RuntimeException)ex;
} else {
// ignore - we just can't get stats
}
}
if (counters == null) {
return;
}
// TODO: remove deprecation suppress when we don't want to rely on org.apache.hadoop.mapred
Counter count = counters.findCounter(Task.Counter.MAP_INPUT_RECORDS);
for (int i = 0; i < safeLongToInt(count.getValue()); i++) {
contribution.incrementReadCount();
}
count = counters.findCounter(Task.Counter.MAP_SKIPPED_RECORDS);
contribution.incrementReadSkipCount(safeLongToInt(count.getValue()));
count = counters.findCounter(Task.Counter.REDUCE_OUTPUT_RECORDS);
contribution.incrementWriteCount(safeLongToInt(count.getValue()));
count = counters.findCounter(Task.Counter.REDUCE_SKIPPED_RECORDS);
for (int i = 0; i < safeLongToInt(count.getValue()); i++) {
contribution.incrementWriteSkipCount();
}
}