4

我的原始问题

因为在这个问题中只找到了对该问题的可行 答案,而答案在旧 API 中。所以这迫使我提出一个愚蠢的问题,将这些行翻译成New 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 )
    {

    }

谢谢 :) :)

4

1 回答 1

3

演示文稿总结了新旧 API 之间的变化。

于 2012-09-25T13:34:38.930 回答