/// <exception cref="System.Exception"/>
        private void Run(bool ioEx, bool rtEx)
        {
            string        localPathRoot = Runtime.GetProperty("test.build.data", "/tmp");
            Path          inDir         = new Path(localPathRoot, "testing/mt/input");
            Path          outDir        = new Path(localPathRoot, "testing/mt/output");
            Configuration conf          = CreateJobConf();

            if (ioEx)
            {
                conf.SetBoolean("multithreaded.ioException", true);
            }
            if (rtEx)
            {
                conf.SetBoolean("multithreaded.runtimeException", true);
            }
            Job job = MapReduceTestUtil.CreateJob(conf, inDir, outDir, 1, 1);

            job.SetJobName("mt");
            job.SetMapperClass(typeof(MultithreadedMapper));
            MultithreadedMapper.SetMapperClass(job, typeof(TestMultithreadedMapper.IDMap));
            MultithreadedMapper.SetNumberOfThreads(job, 2);
            job.SetReducerClass(typeof(Reducer));
            job.WaitForCompletion(true);
            if (job.IsSuccessful())
            {
                NUnit.Framework.Assert.IsFalse(ioEx || rtEx);
            }
            else
            {
                NUnit.Framework.Assert.IsTrue(ioEx || rtEx);
            }
        }
Esempio n. 2
0
            /// <exception cref="System.IO.IOException"/>
            /// <exception cref="System.Exception"/>
            internal MapRunner(MultithreadedMapper <K1, V1, K2, V2> _enclosing, Mapper.Context
                               context)
            {
                this._enclosing = _enclosing;
                reader          = new MultithreadedMapper.SubMapRecordReader(this);
                this.mapper     = ReflectionUtils.NewInstance(this._enclosing.mapClass, context.GetConfiguration
                                                                  ());
                MapContext <K1, V1, K2, V2> mapContext = new MapContextImpl <K1, V1, K2, V2>(this._enclosing
                                                                                             .outer.GetConfiguration(), this._enclosing.outer.GetTaskAttemptID(), this.reader
                                                                                             , new MultithreadedMapper.SubMapRecordWriter(this), context.GetOutputCommitter()
                                                                                             , new MultithreadedMapper.SubMapStatusReporter(this), this._enclosing.outer.GetInputSplit
                                                                                                 ());

                this.subcontext = new WrappedMapper <K1, V1, K2, V2>().GetMapContext(mapContext);
                this.reader.Initialize(context.GetInputSplit(), context);
            }
Esempio n. 3
0
 internal SubMapStatusReporter(MultithreadedMapper <K1, V1, K2, V2> _enclosing)
 {
     this._enclosing = _enclosing;
 }
Esempio n. 4
0
 internal SubMapRecordWriter(MultithreadedMapper <K1, V1, K2, V2> _enclosing)
 {
     this._enclosing = _enclosing;
 }