/// <exception cref="System.IO.IOException"/> /// <exception cref="System.Exception"/> internal virtual void RunMapper(TaskInputOutputContext context, int index) { Mapper mapper = mappers[index]; RecordReader rr = new Chain.ChainRecordReader(context); RecordWriter rw = new Chain.ChainRecordWriter(context); Mapper.Context mapperContext = CreateMapContext(rr, rw, context, GetConf(index)); mapper.Run(mapperContext); rr.Close(); rw.Close(context); }
/// <summary> /// Add mapper(the last mapper) that reads input from /// queue and writes output to the output context /// </summary> /// <exception cref="System.IO.IOException"/> /// <exception cref="System.Exception"/> internal virtual void AddMapper(Chain.ChainBlockingQueue <Chain.KeyValuePair <object , object> > input, TaskInputOutputContext outputContext, int index) { Configuration conf = GetConf(index); Type keyClass = conf.GetClass(MapperInputKeyClass, typeof(object)); Type valueClass = conf.GetClass(MapperInputValueClass, typeof(object)); RecordReader rr = new Chain.ChainRecordReader(keyClass, valueClass, input, conf); RecordWriter rw = new Chain.ChainRecordWriter(outputContext); Chain.MapRunner runner = new Chain.MapRunner(this, mappers[index], CreateMapContext (rr, rw, outputContext, GetConf(index)), rr, rw); threads.AddItem(runner); }