因为在This Question 中找到了对该问题的可行回答 答案是旧的API。所以这迫使我把一个愚蠢的问题翻译成新API :
private long mapperCounter;
@Override
public void configure(JobConf conf) {
JobClient client = new JobClient(conf);
RunningJob parentJob =
client.getJob(JobID.forName( conf.get("mapred.job.id") ));
mapperCounter = parentJob.getCounters().getCounter(MAP_COUNTER_NAME);
}
注意:我希望在reducer中使用此代码,因此可用的继承函数是:
@Override
protected void setup(Context context) throws IOException,
InterruptedException {
}
@Override
protected void cleanup(Context context) throws IOException,
InterruptedException {
}
@Override
public void run(Context context) throws IOException,
InterruptedException {
Job job=new Job(context.getConfiguration());
}
@Override
public void reduce(ImmutableBytesWritable key,Iterable<ImmutableBytesWritable> result,Context context )
{
}
谢谢:) :)