我最初的问题
因为在这个问题中只能找到这个问题的可行答案,而答案是在旧的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 )
{
}
谢谢:):)
1条答案
按热度按时间u3r8eeie1#
本演示文稿总结了新旧api之间的更改。