コード例 #1
0
            /// <exception cref="System.IO.IOException"/>
            /// <exception cref="System.Exception"/>
            protected override void Map(LongWritable key, Text value, Mapper.Context context)
            {
                // get the map phase progress
                float mapPhaseProgress = ((float)++recordCount) / InputLines;
                // get the weighted map phase progress
                float weightedMapProgress = progressRange * mapPhaseProgress;

                // check the map progress
                NUnit.Framework.Assert.AreEqual("Invalid progress in map", weightedMapProgress, context
                                                .GetProgress(), 0f);
                context.Write(new Text(value.ToString() + recordCount), value);
            }
コード例 #2
0
 /// <exception cref="System.IO.IOException"/>
 /// <exception cref="System.Exception"/>
 protected override void Cleanup(Mapper.Context context)
 {
     // check if the attempt progress is at the progress boundary
     NUnit.Framework.Assert.AreEqual("Invalid progress in map cleanup", progressRange,
                                     context.GetProgress(), 0f);
 }
コード例 #3
0
            // check map task reports
            // TODO fix testcase
            // Disabling checks for now to get builds to run

            /*
             * reports = job.getTaskReports(TaskType.MAP);
             * assertEquals(numMaps, reports.length);
             * assertEquals("map > sort", reports[0].getState());
             *
             * // check reduce task reports
             * reports = job.getTaskReports(TaskType.REDUCE);
             * assertEquals(numReduces, reports.length);
             * assertEquals("reduce > reduce", reports[0].getState());
             */
            // an input with 4 lines
            /// <exception cref="System.IO.IOException"/>
            protected override void Setup(Mapper.Context context)
            {
                // check if the map task attempt progress is 0
                NUnit.Framework.Assert.AreEqual("Invalid progress in map setup", 0.0f, context.GetProgress
                                                    (), 0f);
                // define the progress boundaries
                if (context.GetNumReduceTasks() == 0)
                {
                    progressRange = 1f;
                }
                else
                {
                    progressRange = 0.667f;
                }
            }