Repository: incubator-reef
Updated Branches:
  refs/heads/master 7241317b5 -> 4b7288de8


[REEF-623] Move MapperCount example to REEF.IMRU.Examples

This moves MapperCount example in REEF.IMRU to REEF.IMRU.Examples and
updates corresponding references.

JIRA:
  [REEF-623](https://issues.apache.org/jira/browse/REEF-623)

Pull Request:
  This closes #398


Project: http://git-wip-us.apache.org/repos/asf/incubator-reef/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-reef/commit/4b7288de
Tree: http://git-wip-us.apache.org/repos/asf/incubator-reef/tree/4b7288de
Diff: http://git-wip-us.apache.org/repos/asf/incubator-reef/diff/4b7288de

Branch: refs/heads/master
Commit: 4b7288de85938fb21162c24fad2b513f3019ec0a
Parents: 7241317
Author: Dhruv <[email protected]>
Authored: Thu Aug 20 21:10:22 2015 -0700
Committer: Markus Weimer <[email protected]>
Committed: Fri Aug 21 10:19:35 2015 -0700

----------------------------------------------------------------------
 .../MapperCount/IdentityMapFunction.cs          | 45 +++++++++++
 .../MapperCount/IntSumReduceFunction.cs         | 47 +++++++++++
 .../MapperCount/MapperCount.cs                  | 83 ++++++++++++++++++++
 .../MapperCount/MapperCountUpdateFunction.cs    | 58 ++++++++++++++
 .../Org.Apache.REEF.IMRU.Examples.csproj        |  8 ++
 lang/cs/Org.Apache.REEF.IMRU.Examples/Run.cs    |  1 -
 .../Org.Apache.REEF.IMRU.Tests.csproj           |  4 +
 .../Examples/MapperCount/IdentityMapFunction.cs | 45 -----------
 .../MapperCount/IntSumReduceFunction.cs         | 47 -----------
 .../Examples/MapperCount/MapperCount.cs         | 83 --------------------
 .../MapperCount/MapperCountUpdateFunction.cs    | 58 --------------
 .../Org.Apache.REEF.IMRU.csproj                 |  4 -
 12 files changed, 245 insertions(+), 238 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/4b7288de/lang/cs/Org.Apache.REEF.IMRU.Examples/MapperCount/IdentityMapFunction.cs
----------------------------------------------------------------------
diff --git 
a/lang/cs/Org.Apache.REEF.IMRU.Examples/MapperCount/IdentityMapFunction.cs 
b/lang/cs/Org.Apache.REEF.IMRU.Examples/MapperCount/IdentityMapFunction.cs
new file mode 100644
index 0000000..19eaeb5
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.IMRU.Examples/MapperCount/IdentityMapFunction.cs
@@ -0,0 +1,45 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+using Org.Apache.REEF.IMRU.API;
+using Org.Apache.REEF.Tang.Annotations;
+
+namespace Org.Apache.REEF.IMRU.Examples.MapperCount
+{
+    /// <summary>
+    /// A MapFunction that returns its input.
+    /// </summary>
+    public sealed class IdentityMapFunction : IMapFunction<int, int>
+    {
+        [Inject]
+        private IdentityMapFunction()
+        {
+        }
+
+        /// <summary>
+        /// Identity map function
+        /// </summary>
+        /// <param name="mapInput"></param>
+        /// <returns>mapInput itself</returns>
+        public int Map(int mapInput)
+        {
+            return mapInput;
+        }
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/4b7288de/lang/cs/Org.Apache.REEF.IMRU.Examples/MapperCount/IntSumReduceFunction.cs
----------------------------------------------------------------------
diff --git 
a/lang/cs/Org.Apache.REEF.IMRU.Examples/MapperCount/IntSumReduceFunction.cs 
b/lang/cs/Org.Apache.REEF.IMRU.Examples/MapperCount/IntSumReduceFunction.cs
new file mode 100644
index 0000000..94c4332
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.IMRU.Examples/MapperCount/IntSumReduceFunction.cs
@@ -0,0 +1,47 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+using System.Collections.Generic;
+using System.Linq;
+using Org.Apache.REEF.Network.Group.Operators;
+using Org.Apache.REEF.Tang.Annotations;
+
+namespace Org.Apache.REEF.IMRU.Examples.MapperCount
+{
+    /// <summary>
+    /// A reduce function that sums integers.
+    /// </summary>
+    public sealed class IntSumReduceFunction : IReduceFunction<int>
+    {
+        [Inject]
+        private IntSumReduceFunction()
+        {
+        }
+
+        /// <summary>
+        /// Reduce function that returns the sum of elements 
+        /// </summary>
+        /// <param name="elements">List of elements</param>
+        /// <returns>The sum of elements</returns>
+        public int Reduce(IEnumerable<int> elements)
+        {
+            return elements.Aggregate((x, y) => x + y);
+        }
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/4b7288de/lang/cs/Org.Apache.REEF.IMRU.Examples/MapperCount/MapperCount.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.IMRU.Examples/MapperCount/MapperCount.cs 
b/lang/cs/Org.Apache.REEF.IMRU.Examples/MapperCount/MapperCount.cs
new file mode 100644
index 0000000..ae57e48
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.IMRU.Examples/MapperCount/MapperCount.cs
@@ -0,0 +1,83 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+using System.Linq;
+using Org.Apache.REEF.IMRU.API;
+using Org.Apache.REEF.IO.PartitionedData.Random;
+using Org.Apache.REEF.Tang.Annotations;
+using Org.Apache.REEF.Tang.Util;
+using Org.Apache.REEF.Wake.StreamingCodec.CommonStreamingCodecs;
+
+namespace Org.Apache.REEF.IMRU.Examples.MapperCount
+{
+    /// <summary>
+    /// A simple IMRU program that counts the number of map function instances 
launched.
+    /// </summary>
+    public sealed class MapperCount
+    {
+        private readonly IIMRUClient<int, int, int> _imruClient;
+
+        [Inject]
+        private MapperCount(IIMRUClient<int, int, int> imruClient)
+        {
+            _imruClient = imruClient;
+        }
+
+        /// <summary>
+        /// Runs the actual mapper count job
+        /// </summary>
+        /// <returns>The number of MapFunction instances that are part of the 
job.</returns>
+        public int Run(int numberofMappers)
+        {
+            var results = _imruClient.Submit(
+                new IMRUJobDefinitionBuilder()
+                    .SetMapFunctionConfiguration(IMRUMapConfiguration<int, 
int>.ConfigurationModule
+                        .Set(IMRUMapConfiguration<int, int>.MapFunction, 
GenericType<IdentityMapFunction>.Class)
+                        .Build())
+                    .SetUpdateFunctionConfiguration(
+                        IMRUUpdateConfiguration<int, int, 
int>.ConfigurationModule
+                            .Set(IMRUUpdateConfiguration<int, int, 
int>.UpdateFunction,
+                                GenericType<MapperCountUpdateFunction>.Class)
+                            .Build())
+                    
.SetMapInputCodecConfiguration(IMRUCodecConfiguration<int>.ConfigurationModule
+                        .Set(IMRUCodecConfiguration<int>.Codec, 
GenericType<IntStreamingCodec>.Class)
+                        .Build())
+                    
.SetUpdateFunctionCodecsConfiguration(IMRUCodecConfiguration<int>.ConfigurationModule
+                        .Set(IMRUCodecConfiguration<int>.Codec, 
GenericType<IntStreamingCodec>.Class)
+                        .Build())
+                    
.SetReduceFunctionConfiguration(IMRUReduceFunctionConfiguration<int>.ConfigurationModule
+                        
.Set(IMRUReduceFunctionConfiguration<int>.ReduceFunction,
+                            GenericType<IntSumReduceFunction>.Class)
+                        .Build())
+                    .SetPartitionedDatasetConfiguration(
+                        
RandomDataConfiguration.ConfigurationModule.Set(RandomDataConfiguration.NumberOfPartitions,
+                            numberofMappers.ToString()).Build())
+                    .SetJobName("MapperCount")
+                    .SetNumberOfMappers(numberofMappers)
+                    .Build());
+
+            if (results != null)
+            {
+                return results.First();
+            }
+
+            return -1;
+        }
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/4b7288de/lang/cs/Org.Apache.REEF.IMRU.Examples/MapperCount/MapperCountUpdateFunction.cs
----------------------------------------------------------------------
diff --git 
a/lang/cs/Org.Apache.REEF.IMRU.Examples/MapperCount/MapperCountUpdateFunction.cs
 
b/lang/cs/Org.Apache.REEF.IMRU.Examples/MapperCount/MapperCountUpdateFunction.cs
new file mode 100644
index 0000000..72f25ec
--- /dev/null
+++ 
b/lang/cs/Org.Apache.REEF.IMRU.Examples/MapperCount/MapperCountUpdateFunction.cs
@@ -0,0 +1,58 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+using Org.Apache.REEF.IMRU.API;
+using Org.Apache.REEF.Tang.Annotations;
+
+namespace Org.Apache.REEF.IMRU.Examples.MapperCount
+{
+    /// <summary>
+    /// The Update function for the mapper counting job.
+    /// </summary>
+    /// <remarks>
+    /// Upon Initialize(), this sends `1` to all Map Function instances. Each 
of them returns `1`, which shows up as the
+    /// parameter passed into `Update`. At that point, we can immediately 
terminate.
+    /// </remarks>
+    public sealed class MapperCountUpdateFunction : IUpdateFunction<int, int, 
int>
+    {
+        [Inject]
+        private MapperCountUpdateFunction()
+        {
+        }
+
+        /// <summary>
+        /// Update function
+        /// </summary>
+        /// <param name="input">Input containing sum of all mappers</param>
+        /// <returns>The Update Result with only result</returns>
+        public UpdateResult<int, int> Update(int input)
+        {
+            return UpdateResult<int, int>.Done(input);
+        }
+
+        /// <summary>
+        /// Initialize function. Sends 1 to all mappers
+        /// </summary>
+        /// <returns>Map input</returns>
+        public UpdateResult<int, int> Initialize()
+        {
+            return UpdateResult<int, int>.AnotherRound(1);
+        }
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/4b7288de/lang/cs/Org.Apache.REEF.IMRU.Examples/Org.Apache.REEF.IMRU.Examples.csproj
----------------------------------------------------------------------
diff --git 
a/lang/cs/Org.Apache.REEF.IMRU.Examples/Org.Apache.REEF.IMRU.Examples.csproj 
b/lang/cs/Org.Apache.REEF.IMRU.Examples/Org.Apache.REEF.IMRU.Examples.csproj
index cb335c7..2072827 100644
--- a/lang/cs/Org.Apache.REEF.IMRU.Examples/Org.Apache.REEF.IMRU.Examples.csproj
+++ b/lang/cs/Org.Apache.REEF.IMRU.Examples/Org.Apache.REEF.IMRU.Examples.csproj
@@ -42,6 +42,10 @@ under the License.
     <Reference Include="System.Xml" />
   </ItemGroup>
   <ItemGroup>
+    <Compile Include="MapperCount\IdentityMapFunction.cs" />
+    <Compile Include="MapperCount\IntSumReduceFunction.cs" />
+    <Compile Include="MapperCount\MapperCount.cs" />
+    <Compile Include="MapperCount\MapperCountUpdateFunction.cs" />
     <Compile Include="Run.cs" />
     <Compile Include="Properties\AssemblyInfo.cs" />
   </ItemGroup>
@@ -86,6 +90,10 @@ under the License.
       <Project>{883ce800-6a6a-4e0a-b7fe-c054f4f2c1dc}</Project>
       <Name>Org.Apache.REEF.Network</Name>
     </ProjectReference>
+    <ProjectReference 
Include="$(SolutionDir)\Org.Apache.REEF.IO\Org.Apache.REEF.IO.csproj">
+      <Project>{dec0f0a8-dbef-4ebf-b69c-e2369c15abf1}</Project>
+      <Name>Org.Apache.REEF.IO</Name>
+    </ProjectReference>
   </ItemGroup>
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
 </Project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/4b7288de/lang/cs/Org.Apache.REEF.IMRU.Examples/Run.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.IMRU.Examples/Run.cs 
b/lang/cs/Org.Apache.REEF.IMRU.Examples/Run.cs
index d1cc1ba..9d3892d 100644
--- a/lang/cs/Org.Apache.REEF.IMRU.Examples/Run.cs
+++ b/lang/cs/Org.Apache.REEF.IMRU.Examples/Run.cs
@@ -23,7 +23,6 @@ using System.Linq;
 using Org.Apache.REEF.IMRU.OnREEF;
 using Org.Apache.REEF.Tang.Implementations.Tang;
 using Org.Apache.REEF.Wake.Remote.Parameters;
-using Org.Apache.REEF.IMRU.Examples.MapperCount;
 using Org.Apache.REEF.Tang.Interface;
 
 namespace Org.Apache.REEF.IMRU.Examples

http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/4b7288de/lang/cs/Org.Apache.REEF.IMRU.Tests/Org.Apache.REEF.IMRU.Tests.csproj
----------------------------------------------------------------------
diff --git 
a/lang/cs/Org.Apache.REEF.IMRU.Tests/Org.Apache.REEF.IMRU.Tests.csproj 
b/lang/cs/Org.Apache.REEF.IMRU.Tests/Org.Apache.REEF.IMRU.Tests.csproj
index 8288c77..dc627a1 100644
--- a/lang/cs/Org.Apache.REEF.IMRU.Tests/Org.Apache.REEF.IMRU.Tests.csproj
+++ b/lang/cs/Org.Apache.REEF.IMRU.Tests/Org.Apache.REEF.IMRU.Tests.csproj
@@ -61,6 +61,10 @@ under the License.
       <Project>{cdfb3464-4041-42b1-9271-83af24cd5008}</Project>
       <Name>Org.Apache.REEF.Wake</Name>
     </ProjectReference>
+    <ProjectReference 
Include="$(SolutionDir)\Org.Apache.REEF.IMRU.Examples\Org.Apache.REEF.IMRU.Examples.csproj">
+      <Project>{6dc3b04e-2b99-4fda-bd23-2c7864f4c477}</Project>
+      <Name>Org.Apache.REEF.IMRU.Examples</Name>
+    </ProjectReference>
   </ItemGroup>
   <ItemGroup>
     <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />

http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/4b7288de/lang/cs/Org.Apache.REEF.IMRU/Examples/MapperCount/IdentityMapFunction.cs
----------------------------------------------------------------------
diff --git 
a/lang/cs/Org.Apache.REEF.IMRU/Examples/MapperCount/IdentityMapFunction.cs 
b/lang/cs/Org.Apache.REEF.IMRU/Examples/MapperCount/IdentityMapFunction.cs
deleted file mode 100644
index 19eaeb5..0000000
--- a/lang/cs/Org.Apache.REEF.IMRU/Examples/MapperCount/IdentityMapFunction.cs
+++ /dev/null
@@ -1,45 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-using Org.Apache.REEF.IMRU.API;
-using Org.Apache.REEF.Tang.Annotations;
-
-namespace Org.Apache.REEF.IMRU.Examples.MapperCount
-{
-    /// <summary>
-    /// A MapFunction that returns its input.
-    /// </summary>
-    public sealed class IdentityMapFunction : IMapFunction<int, int>
-    {
-        [Inject]
-        private IdentityMapFunction()
-        {
-        }
-
-        /// <summary>
-        /// Identity map function
-        /// </summary>
-        /// <param name="mapInput"></param>
-        /// <returns>mapInput itself</returns>
-        public int Map(int mapInput)
-        {
-            return mapInput;
-        }
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/4b7288de/lang/cs/Org.Apache.REEF.IMRU/Examples/MapperCount/IntSumReduceFunction.cs
----------------------------------------------------------------------
diff --git 
a/lang/cs/Org.Apache.REEF.IMRU/Examples/MapperCount/IntSumReduceFunction.cs 
b/lang/cs/Org.Apache.REEF.IMRU/Examples/MapperCount/IntSumReduceFunction.cs
deleted file mode 100644
index 94c4332..0000000
--- a/lang/cs/Org.Apache.REEF.IMRU/Examples/MapperCount/IntSumReduceFunction.cs
+++ /dev/null
@@ -1,47 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-using System.Collections.Generic;
-using System.Linq;
-using Org.Apache.REEF.Network.Group.Operators;
-using Org.Apache.REEF.Tang.Annotations;
-
-namespace Org.Apache.REEF.IMRU.Examples.MapperCount
-{
-    /// <summary>
-    /// A reduce function that sums integers.
-    /// </summary>
-    public sealed class IntSumReduceFunction : IReduceFunction<int>
-    {
-        [Inject]
-        private IntSumReduceFunction()
-        {
-        }
-
-        /// <summary>
-        /// Reduce function that returns the sum of elements 
-        /// </summary>
-        /// <param name="elements">List of elements</param>
-        /// <returns>The sum of elements</returns>
-        public int Reduce(IEnumerable<int> elements)
-        {
-            return elements.Aggregate((x, y) => x + y);
-        }
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/4b7288de/lang/cs/Org.Apache.REEF.IMRU/Examples/MapperCount/MapperCount.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.IMRU/Examples/MapperCount/MapperCount.cs 
b/lang/cs/Org.Apache.REEF.IMRU/Examples/MapperCount/MapperCount.cs
deleted file mode 100644
index ae57e48..0000000
--- a/lang/cs/Org.Apache.REEF.IMRU/Examples/MapperCount/MapperCount.cs
+++ /dev/null
@@ -1,83 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-using System.Linq;
-using Org.Apache.REEF.IMRU.API;
-using Org.Apache.REEF.IO.PartitionedData.Random;
-using Org.Apache.REEF.Tang.Annotations;
-using Org.Apache.REEF.Tang.Util;
-using Org.Apache.REEF.Wake.StreamingCodec.CommonStreamingCodecs;
-
-namespace Org.Apache.REEF.IMRU.Examples.MapperCount
-{
-    /// <summary>
-    /// A simple IMRU program that counts the number of map function instances 
launched.
-    /// </summary>
-    public sealed class MapperCount
-    {
-        private readonly IIMRUClient<int, int, int> _imruClient;
-
-        [Inject]
-        private MapperCount(IIMRUClient<int, int, int> imruClient)
-        {
-            _imruClient = imruClient;
-        }
-
-        /// <summary>
-        /// Runs the actual mapper count job
-        /// </summary>
-        /// <returns>The number of MapFunction instances that are part of the 
job.</returns>
-        public int Run(int numberofMappers)
-        {
-            var results = _imruClient.Submit(
-                new IMRUJobDefinitionBuilder()
-                    .SetMapFunctionConfiguration(IMRUMapConfiguration<int, 
int>.ConfigurationModule
-                        .Set(IMRUMapConfiguration<int, int>.MapFunction, 
GenericType<IdentityMapFunction>.Class)
-                        .Build())
-                    .SetUpdateFunctionConfiguration(
-                        IMRUUpdateConfiguration<int, int, 
int>.ConfigurationModule
-                            .Set(IMRUUpdateConfiguration<int, int, 
int>.UpdateFunction,
-                                GenericType<MapperCountUpdateFunction>.Class)
-                            .Build())
-                    
.SetMapInputCodecConfiguration(IMRUCodecConfiguration<int>.ConfigurationModule
-                        .Set(IMRUCodecConfiguration<int>.Codec, 
GenericType<IntStreamingCodec>.Class)
-                        .Build())
-                    
.SetUpdateFunctionCodecsConfiguration(IMRUCodecConfiguration<int>.ConfigurationModule
-                        .Set(IMRUCodecConfiguration<int>.Codec, 
GenericType<IntStreamingCodec>.Class)
-                        .Build())
-                    
.SetReduceFunctionConfiguration(IMRUReduceFunctionConfiguration<int>.ConfigurationModule
-                        
.Set(IMRUReduceFunctionConfiguration<int>.ReduceFunction,
-                            GenericType<IntSumReduceFunction>.Class)
-                        .Build())
-                    .SetPartitionedDatasetConfiguration(
-                        
RandomDataConfiguration.ConfigurationModule.Set(RandomDataConfiguration.NumberOfPartitions,
-                            numberofMappers.ToString()).Build())
-                    .SetJobName("MapperCount")
-                    .SetNumberOfMappers(numberofMappers)
-                    .Build());
-
-            if (results != null)
-            {
-                return results.First();
-            }
-
-            return -1;
-        }
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/4b7288de/lang/cs/Org.Apache.REEF.IMRU/Examples/MapperCount/MapperCountUpdateFunction.cs
----------------------------------------------------------------------
diff --git 
a/lang/cs/Org.Apache.REEF.IMRU/Examples/MapperCount/MapperCountUpdateFunction.cs
 
b/lang/cs/Org.Apache.REEF.IMRU/Examples/MapperCount/MapperCountUpdateFunction.cs
deleted file mode 100644
index 72f25ec..0000000
--- 
a/lang/cs/Org.Apache.REEF.IMRU/Examples/MapperCount/MapperCountUpdateFunction.cs
+++ /dev/null
@@ -1,58 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-using Org.Apache.REEF.IMRU.API;
-using Org.Apache.REEF.Tang.Annotations;
-
-namespace Org.Apache.REEF.IMRU.Examples.MapperCount
-{
-    /// <summary>
-    /// The Update function for the mapper counting job.
-    /// </summary>
-    /// <remarks>
-    /// Upon Initialize(), this sends `1` to all Map Function instances. Each 
of them returns `1`, which shows up as the
-    /// parameter passed into `Update`. At that point, we can immediately 
terminate.
-    /// </remarks>
-    public sealed class MapperCountUpdateFunction : IUpdateFunction<int, int, 
int>
-    {
-        [Inject]
-        private MapperCountUpdateFunction()
-        {
-        }
-
-        /// <summary>
-        /// Update function
-        /// </summary>
-        /// <param name="input">Input containing sum of all mappers</param>
-        /// <returns>The Update Result with only result</returns>
-        public UpdateResult<int, int> Update(int input)
-        {
-            return UpdateResult<int, int>.Done(input);
-        }
-
-        /// <summary>
-        /// Initialize function. Sends 1 to all mappers
-        /// </summary>
-        /// <returns>Map input</returns>
-        public UpdateResult<int, int> Initialize()
-        {
-            return UpdateResult<int, int>.AnotherRound(1);
-        }
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/4b7288de/lang/cs/Org.Apache.REEF.IMRU/Org.Apache.REEF.IMRU.csproj
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.IMRU/Org.Apache.REEF.IMRU.csproj 
b/lang/cs/Org.Apache.REEF.IMRU/Org.Apache.REEF.IMRU.csproj
index 997e4bf..b47aff7 100644
--- a/lang/cs/Org.Apache.REEF.IMRU/Org.Apache.REEF.IMRU.csproj
+++ b/lang/cs/Org.Apache.REEF.IMRU/Org.Apache.REEF.IMRU.csproj
@@ -52,10 +52,6 @@ under the License.
     <Compile Include="API\IMRUUpdateConfiguration.cs" />
     <Compile Include="API\IUpdateFunction.cs" />
     <Compile Include="API\UpdateResult.cs" />
-    <Compile Include="Examples\MapperCount\MapperCount.cs" />
-    <Compile Include="Examples\MapperCount\IdentityMapFunction.cs" />
-    <Compile Include="Examples\MapperCount\IntSumReduceFunction.cs" />
-    <Compile Include="Examples\MapperCount\MapperCountUpdateFunction.cs" />
     <Compile Include="InProcess\IMRURunner.cs" />
     <Compile Include="InProcess\InProcessIMRUClient.cs" />
     <Compile Include="InProcess\InProcessIMRUConfiguration.cs" />

Reply via email to