Exemple #1
0
            /// <exception cref="System.IO.IOException"/>
            public virtual void Reduce(Org.Apache.Hadoop.IO.Text key, IEnumerator <Org.Apache.Hadoop.IO.Text
                                                                                   > values, OutputCollector <Org.Apache.Hadoop.IO.Text, Org.Apache.Hadoop.IO.Text>
                                       output, Reporter reporter)
            {
                float reducePhaseProgress         = ((float)++recordCount) / InputLines;
                float weightedReducePhaseProgress = reducePhaseProgress * ReduceProgressRange;

                NUnit.Framework.Assert.AreEqual("Invalid progress in reduce", ShuffleProgressRange
                                                + weightedReducePhaseProgress, reporter.GetProgress(), 0.02f);
                this.reporter = reporter;
            }
        /// <summary>test Reporter.NULL</summary>
        public virtual void TestReporter()
        {
            Reporter nullReporter = Reporter.Null;

            NUnit.Framework.Assert.IsNull(nullReporter.GetCounter(null));
            NUnit.Framework.Assert.IsNull(nullReporter.GetCounter("group", "name"));
            // getInputSplit method removed
            try
            {
                NUnit.Framework.Assert.IsNull(nullReporter.GetInputSplit());
            }
            catch (NotSupportedException e)
            {
                NUnit.Framework.Assert.AreEqual("NULL reporter has no input", e.Message);
            }
            NUnit.Framework.Assert.AreEqual(0, nullReporter.GetProgress(), 0.01);
        }
 public override float GetProgress()
 {
     return(reporter.GetProgress());
 }
Exemple #4
0
 /// <exception cref="System.IO.IOException"/>
 public override void Close()
 {
     base.Close();
     NUnit.Framework.Assert.AreEqual("Invalid progress in map cleanup", progressRange,
                                     reporter.GetProgress(), 0f);
 }
Exemple #5
0
            /// <exception cref="System.IO.IOException"/>
            public virtual void Map(LongWritable key, Text value, OutputCollector <Text, Text>
                                    output, Reporter reporter)
            {
                this.reporter = reporter;
                // calculate the actual map progress
                float mapProgress = ((float)++numRecords) / InputLines;
                // calculate the attempt progress based on the progress range
                float attemptProgress = progressRange * mapProgress;

                NUnit.Framework.Assert.AreEqual("Invalid progress in map", attemptProgress, reporter
                                                .GetProgress(), 0f);
                output.Collect(new Text(value.ToString() + numRecords), value);
            }
Exemple #6
0
 /// <exception cref="System.IO.IOException"/>
 public override void Close()
 {
     base.Close();
     NUnit.Framework.Assert.AreEqual("Invalid progress in reduce cleanup", 1.0f, reporter
                                     .GetProgress(), 0f);
 }