You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@reef.apache.org by se...@apache.org on 2015/10/09 03:11:05 UTC
incubator-reef git commit: [REEF-538] Implement IPartitionedDataSet
on IFileSystem
Repository: incubator-reef
Updated Branches:
refs/heads/master d7ab67ad4 -> 5f238d016
[REEF-538] Implement IPartitionedDataSet on IFileSystem
Add implementation of IPartitionedDataSet and IPartition for FileSystem
Added FileSerailiser interface and pass it along to the Ipartition
Added unit test cases
Added IO.CLientTEst for running tests on YARN
JIRA: [REEF-538](https://issues.apache.org/jira/browse/REEF-538)
This closes #536
Project: http://git-wip-us.apache.org/repos/asf/incubator-reef/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-reef/commit/5f238d01
Tree: http://git-wip-us.apache.org/repos/asf/incubator-reef/tree/5f238d01
Diff: http://git-wip-us.apache.org/repos/asf/incubator-reef/diff/5f238d01
Branch: refs/heads/master
Commit: 5f238d016f4a51b86c0fdfb54f1db99ff71679db
Parents: d7ab67a
Author: Julia Wang <ju...@microsoft.com>
Authored: Fri Oct 2 11:37:47 2015 -0700
Committer: Beysim Sezgin <be...@hotmail.com>
Committed: Thu Oct 8 18:02:52 2015 -0700
----------------------------------------------------------------------
.../HadoopFilePartitionTest.cs | 163 ++++++++++
.../HadoopFileSystemTest.cs | 162 ++++++++++
.../Org.Apache.REEF.IO.TestClient.csproj | 105 +++++++
.../Properties/AssemblyInfo.cs | 55 ++++
lang/cs/Org.Apache.REEF.IO.TestClient/Run.cs | 72 +++++
.../Org.Apache.REEF.IO.Tests.csproj | 1 +
.../TestFilePartitionDataSet.cs | 311 +++++++++++++++++++
.../TestRandomDataSet.cs | 10 +-
.../FileSystem/IFileSystem.cs | 6 +
.../FileSystem/Local/LocalFileSystem.cs | 9 +
.../Org.Apache.REEF.IO.csproj | 8 +
.../FileSystem/FilePartitionDescriptor.cs | 68 ++++
.../FileSystem/FileSystemPartition.cs | 148 +++++++++
.../FileSystemPartitionConfiguration.cs | 53 ++++
.../FileSystem/FileSystemPartitionDataSet.cs | 138 ++++++++
.../FileSystem/IFileDeSerializer.cs | 39 +++
.../Parameters/FilePathsForPatitions.cs | 33 ++
.../Parameters/FilePathsInPartition.cs | 32 ++
.../Parameters/FileSerializerConfigString.cs | 28 ++
.../PartitionedData/IPartition.cs | 4 +-
.../PartitionedData/Random/RandomDataSet.cs | 9 +-
.../Properties/AssemblyInfo.cs | 5 +
lang/cs/Org.Apache.REEF.sln | Bin 33136 -> 34154 bytes
23 files changed, 1448 insertions(+), 11 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/5f238d01/lang/cs/Org.Apache.REEF.IO.TestClient/HadoopFilePartitionTest.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.IO.TestClient/HadoopFilePartitionTest.cs b/lang/cs/Org.Apache.REEF.IO.TestClient/HadoopFilePartitionTest.cs
new file mode 100644
index 0000000..a23f347
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.IO.TestClient/HadoopFilePartitionTest.cs
@@ -0,0 +1,163 @@
+/**
+ * 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;
+using System.Collections.Generic;
+using System.Globalization;
+using System.IO;
+using Org.Apache.REEF.IO.FileSystem;
+using Org.Apache.REEF.IO.FileSystem.Hadoop;
+using Org.Apache.REEF.IO.PartitionedData;
+using Org.Apache.REEF.IO.PartitionedData.FileSystem;
+using Org.Apache.REEF.Tang.Annotations;
+using Org.Apache.REEF.Tang.Formats;
+using Org.Apache.REEF.Tang.Implementations.Tang;
+using Org.Apache.REEF.Tang.Interface;
+using Org.Apache.REEF.Tang.Util;
+using Org.Apache.REEF.Utilities.Logging;
+
+namespace Org.Apache.REEF.IO.TestClient
+{
+ //TODO[JIRA REEF-815]: once move to Nunit, tose test should be moved to Test project
+ internal class HadoopFilePartitionTest
+ {
+ private static readonly Logger Logger = Logger.GetLogger(typeof(HadoopFilePartitionTest));
+
+ internal static bool TestWithByteDeserializer()
+ {
+ string remoteFilePath1 = MakeRemoteTestFile(new byte[] { 111, 112, 113 });
+ string remoteFilePath2 = MakeRemoteTestFile(new byte[] { 114, 115, 116, 117 });
+
+ var serializerConf = TangFactory.GetTang().NewConfigurationBuilder()
+ .BindImplementation<IFileDeSerializer<byte>, ByteSerializer>(GenericType<IFileDeSerializer<byte>>.Class,
+ GenericType<ByteSerializer>.Class)
+ .Build();
+ var serializerConfString = (new AvroConfigurationSerializer()).ToString(serializerConf);
+
+ var dataSet = TangFactory.GetTang()
+ .NewInjector(FileSystemPartitionConfiguration<byte>.ConfigurationModule
+ .Set(FileSystemPartitionConfiguration<byte>.FilePathForPartitions, remoteFilePath1)
+ .Set(FileSystemPartitionConfiguration<byte>.FilePathForPartitions, remoteFilePath2)
+ .Set(FileSystemPartitionConfiguration<byte>.FileSerializerConfig, serializerConfString)
+ .Build(),
+ HadoopFileSystemConfiguration.ConfigurationModule.Build())
+ .GetInstance<IPartitionedDataSet>();
+
+ Logger.Log(Level.Info, "IPartitionedDataSet created.");
+
+ int count = 0;
+ foreach (var partitionDescriptor in dataSet)
+ {
+ var partition = TangFactory.GetTang()
+ .NewInjector(partitionDescriptor.GetPartitionConfiguration(), GetHadoopFileSystemConfiguration())
+ .GetInstance<IPartition<IEnumerable<byte>>>();
+
+ using (partition as IDisposable)
+ {
+ Logger.Log(Level.Info, "get partition instance.");
+
+ var e = partition.GetPartitionHandle();
+ foreach (var v in e)
+ {
+ Logger.Log(Level.Info, string.Format(CultureInfo.CurrentCulture, "Data read {0}: ", v));
+ count++;
+ }
+ }
+ }
+ Logger.Log(Level.Info, "Total count returend: " + count);
+ return true;
+ }
+
+ internal static string MakeRemoteTestFile(byte[] bytes)
+ {
+ IFileSystem fileSystem =
+ TangFactory.GetTang()
+ .NewInjector(HadoopFileSystemConfiguration.ConfigurationModule.Build())
+ .GetInstance<IFileSystem>();
+
+ string localFile = MakeLocalTempFile(bytes);
+
+ string remoteFileName = "vol1/test/TestHadoopFilePartition-" +
+ DateTime.Now.ToString("yyyyMMddHHmmssfff");
+
+ var remoteUri = new Uri(fileSystem.UriPrefix + remoteFileName);
+ Logger.Log(Level.Info, string.Format(CultureInfo.CurrentCulture, "remoteUri {0}: ", remoteUri));
+
+ fileSystem.CopyFromLocal(localFile, remoteUri);
+ Logger.Log(Level.Info, string.Format(CultureInfo.CurrentCulture, "File CopyFromLocal {0}: ", localFile));
+
+ return remoteFileName;
+ }
+
+ internal static void MakeLocalTestFile(string filePath, byte[] bytes)
+ {
+ if (File.Exists(filePath))
+ {
+ File.Delete(filePath);
+ }
+
+ using (var s = File.Create(filePath))
+ {
+ foreach (var b in bytes)
+ s.WriteByte(b);
+ }
+ }
+
+ internal static string MakeLocalTempFile(byte[] bytes)
+ {
+ var result = Path.GetTempFileName();
+ MakeLocalTestFile(result, bytes);
+ return result;
+ }
+
+ private static IConfiguration GetHadoopFileSystemConfiguration()
+ {
+ return TangFactory.GetTang().NewConfigurationBuilder()
+ .BindImplementation(typeof(IFileSystem), typeof(HadoopFileSystem))
+ .Build();
+ }
+ }
+
+ internal class ByteSerializer : IFileDeSerializer<byte>
+ {
+ [Inject]
+ private ByteSerializer()
+ { }
+
+ /// <summary>
+ /// Read bytes from all the files in the file folder and return one by one
+ /// </summary>
+ /// <param name="fileFolder"></param>
+ /// <returns></returns>
+ public IEnumerable<byte> Deserialize(string fileFolder)
+ {
+ foreach (var f in Directory.GetFiles(fileFolder))
+ {
+ using (FileStream stream = File.Open(f, FileMode.Open))
+ {
+ BinaryReader reader = new BinaryReader(stream);
+ while (reader.PeekChar() != -1)
+ {
+ yield return reader.ReadByte();
+ }
+ }
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/5f238d01/lang/cs/Org.Apache.REEF.IO.TestClient/HadoopFileSystemTest.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.IO.TestClient/HadoopFileSystemTest.cs b/lang/cs/Org.Apache.REEF.IO.TestClient/HadoopFileSystemTest.cs
new file mode 100644
index 0000000..a71b7fb
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.IO.TestClient/HadoopFileSystemTest.cs
@@ -0,0 +1,162 @@
+/**
+ * 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;
+using System.Globalization;
+using System.IO;
+using Org.Apache.REEF.IO.FileSystem;
+using Org.Apache.REEF.IO.FileSystem.Hadoop;
+using Org.Apache.REEF.Tang.Implementations.Tang;
+using Org.Apache.REEF.Utilities.Logging;
+
+namespace Org.Apache.REEF.IO.TestClient
+{
+ class HadoopFileSystemTest
+ {
+ private static readonly Logger Logger = Logger.GetLogger(typeof(HadoopFileSystemTest));
+
+ public IFileSystem _fileSystem;
+
+ internal HadoopFileSystemTest()
+ {
+ _fileSystem =
+ TangFactory.GetTang()
+ .NewInjector(HadoopFileSystemConfiguration.ConfigurationModule.Build())
+ .GetInstance<IFileSystem>();
+ }
+
+ private Uri GetTempUri()
+ {
+ return
+ new Uri(_fileSystem.UriPrefix + "vol1/test/TestHadoopFileSystem-" +
+ Guid.NewGuid().ToString("N").Substring(0, 8));
+ }
+
+ internal bool TestCopyFromLocalAndBack()
+ {
+ bool result = false;
+
+ var localFile = MakeLocalBanaryFile();
+ Logger.Log(Level.Info, string.Format(CultureInfo.CurrentCulture, "localFile {0}: ", localFile));
+
+ var localFileDownloaded = localFile + ".2";
+ var remoteUri = GetTempUri();
+
+ _fileSystem.CopyFromLocal(localFile, remoteUri);
+ Logger.Log(Level.Info, string.Format(CultureInfo.CurrentCulture, "File CopyFromLocal {0}: ", remoteUri));
+
+ _fileSystem.CopyToLocal(remoteUri, localFileDownloaded);
+ Logger.Log(Level.Info, string.Format(CultureInfo.CurrentCulture, "File CopyToLocal {0}: ", localFileDownloaded));
+
+ if (File.Exists(localFileDownloaded))
+ {
+ Logger.Log(Level.Info, string.Format(CultureInfo.CurrentCulture, "File copied exists {0}: ", localFileDownloaded));
+ ReadFileTest(localFileDownloaded);
+ File.Delete(localFileDownloaded);
+ result = true;
+ }
+ else
+ {
+ Logger.Log(Level.Info, "File does not exist!");
+ result = false;
+ }
+
+ _fileSystem.Delete(remoteUri);
+ File.Delete(localFile);
+ Logger.Log(Level.Info, "End of TestCopyFromLocalAndBack2!");
+
+ return result;
+ }
+
+ internal bool TestCopyFromRemote()
+ {
+ var remoteUri = new Uri(_fileSystem.UriPrefix + "vol1/test/TestHadoopFilePartition-20151002160654404");
+ Logger.Log(Level.Info, string.Format(CultureInfo.CurrentCulture, "remoteUri {0}: ", remoteUri));
+
+ if (!_fileSystem.Exists(remoteUri))
+ {
+ Logger.Log(Level.Info, string.Format(CultureInfo.CurrentCulture, "Remote File {0} doesn't exist.", remoteUri));
+ return false;
+ }
+ else
+ {
+ Logger.Log(Level.Info, string.Format(CultureInfo.CurrentCulture, "Remote File {0} found exists.", remoteUri));
+ }
+
+ var localFile = Path.GetTempPath() + "-" + DateTime.Now.ToString("yyyyMMddHHmmssfff");
+ Logger.Log(Level.Info, string.Format(CultureInfo.CurrentCulture, "localFile {0}.", localFile));
+
+ _fileSystem.CopyToLocal(remoteUri, localFile);
+ Logger.Log(Level.Info, "File CopyToLocal!");
+
+ return true;
+ }
+
+ private string MakeLocalBanaryFile()
+ {
+ var result = Path.GetTempFileName();
+ WriteFileTest(result);
+ return result;
+ }
+
+ private void WriteFileTest(string filePath)
+ {
+ int inputCount = 1;
+ using (FileStream fs = File.Open(filePath, FileMode.Create))
+ {
+ BinaryWriter writer = new BinaryWriter(fs);
+ string strContent = inputCount + " -- firstpart";
+ writer.Write(strContent);
+
+ strContent = inputCount++ + " -- secondpart";
+ writer.Write(strContent);
+
+ writer.Write(1.250F);
+ writer.Write(@"c:\Temp");
+ writer.Write(10);
+ writer.Write(true);
+
+ writer.Flush();
+ }
+ }
+
+ private void ReadFileTest(string filePath)
+ {
+ using (FileStream fs = File.Open(filePath, FileMode.Open))
+ {
+ BinaryReader reader = new BinaryReader(fs);
+
+ string strContent1 = reader.ReadString();
+ string strContent2 = reader.ReadString();
+
+ float aspectRatio = reader.ReadSingle();
+ string tempDirectory = reader.ReadString();
+ int autoSaveTime = reader.ReadInt32();
+ bool showStatusBar = reader.ReadBoolean();
+
+ Logger.Log(Level.Info, "strContent1: " + strContent1);
+ Logger.Log(Level.Info, "strContent2: " + strContent2);
+ Logger.Log(Level.Info, "Aspect ratio set to: " + aspectRatio);
+ Logger.Log(Level.Info, "Temp directory is: " + tempDirectory);
+ Logger.Log(Level.Info, "Auto save time set to: " + autoSaveTime);
+ Logger.Log(Level.Info, "Show status bar: " + showStatusBar);
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/5f238d01/lang/cs/Org.Apache.REEF.IO.TestClient/Org.Apache.REEF.IO.TestClient.csproj
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.IO.TestClient/Org.Apache.REEF.IO.TestClient.csproj b/lang/cs/Org.Apache.REEF.IO.TestClient/Org.Apache.REEF.IO.TestClient.csproj
new file mode 100644
index 0000000..e79c7e7
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.IO.TestClient/Org.Apache.REEF.IO.TestClient.csproj
@@ -0,0 +1,105 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+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.
+-->
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
+ <PropertyGroup>
+ <ProjectGuid>{19D27F4A-8215-4737-8FFE-0709264DF74D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>Org.Apache.REEF.IO.TestClient</RootNamespace>
+ <AssemblyName>Org.Apache.REEF.IO.TestClient</AssemblyName>
+ <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
+ <FileAlignment>512</FileAlignment>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..</SolutionDir>
+ </PropertyGroup>
+ <Import Project="$(SolutionDir)\build.props" />
+ <PropertyGroup>
+ <BuildPackage>false</BuildPackage>
+ <RestorePackages>true</RestorePackages>
+ <UseVSHostingProcess>false</UseVSHostingProcess>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="System" />
+ <Reference Include="System.Core" />
+ <Reference Include="System.Xml.Linq" />
+ <Reference Include="System.Data.DataSetExtensions" />
+ <Reference Include="Microsoft.CSharp" />
+ <Reference Include="System.Data" />
+ <Reference Include="System.Xml" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="HadoopFileSystemTest.cs" />
+ <Compile Include="HadoopFilePartitionTest.cs" />
+ <Compile Include="Run.cs" />
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="$(SolutionDir)\Org.Apache.REEF.Bridge\Org.Apache.REEF.Bridge.vcxproj">
+ <Project>{4e69d40a-26d6-4d4a-b96d-729946c07fe1}</Project>
+ <Name>Org.Apache.REEF.Bridge</Name>
+ </ProjectReference>
+ <ProjectReference Include="$(SolutionDir)\Org.Apache.REEF.Client\Org.Apache.REEF.Client.csproj">
+ <Project>{5094c35b-4fdb-4322-ac05-45d684501cbf}</Project>
+ <Name>Org.Apache.REEF.Client</Name>
+ </ProjectReference>
+ <ProjectReference Include="$(SolutionDir)\Org.Apache.REEF.Common\Org.Apache.REEF.Common.csproj">
+ <Project>{545a0582-4105-44ce-b99c-b1379514a630}</Project>
+ <Name>Org.Apache.REEF.Common</Name>
+ </ProjectReference>
+ <ProjectReference Include="$(SolutionDir)\Org.Apache.REEF.Driver\Org.Apache.REEF.Driver.csproj">
+ <Project>{a6baa2a7-f52f-4329-884e-1bcf711d6805}</Project>
+ <Name>Org.Apache.REEF.Driver</Name>
+ </ProjectReference>
+ <ProjectReference Include="$(SolutionDir)\Org.Apache.REEF.Evaluator\Org.Apache.REEF.Evaluator.csproj">
+ <Project>{1b983182-9c30-464c-948d-f87eb93a8240}</Project>
+ <Name>Org.Apache.REEF.Evaluator</Name>
+ </ProjectReference>
+ <ProjectReference Include="$(SolutionDir)\Org.Apache.REEF.Network.Examples\Org.Apache.REEF.Network.Examples.csproj">
+ <Project>{b1b43b60-ddd0-4805-a9b4-ba84a0ccb7c7}</Project>
+ <Name>Org.Apache.REEF.Network.Examples</Name>
+ </ProjectReference>
+ <ProjectReference Include="$(SolutionDir)\Org.Apache.REEF.Network\Org.Apache.REEF.Network.csproj">
+ <Project>{883ce800-6a6a-4e0a-b7fe-c054f4f2c1dc}</Project>
+ <Name>Org.Apache.REEF.Network</Name>
+ </ProjectReference>
+ <ProjectReference Include="$(SolutionDir)\Org.Apache.REEF.Tang\Org.Apache.REEF.Tang.csproj">
+ <Project>{97dbb573-3994-417a-9f69-ffa25f00d2a6}</Project>
+ <Name>Org.Apache.REEF.Tang</Name>
+ </ProjectReference>
+ <ProjectReference Include="$(SolutionDir)\Org.Apache.REEF.Utilities\Org.Apache.REEF.Utilities.csproj">
+ <Project>{79e7f89a-1dfb-45e1-8d43-d71a954aeb98}</Project>
+ <Name>Org.Apache.REEF.Utilities</Name>
+ </ProjectReference>
+ <ProjectReference Include="$(SolutionDir)\Org.Apache.REEF.Wake\Org.Apache.REEF.Wake.csproj">
+ <Project>{cdfb3464-4041-42b1-9271-83af24cd5008}</Project>
+ <Name>Org.Apache.REEF.Wake</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" />
+ <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
+ Other similar extension points exist, see Microsoft.Common.targets.
+ <Target Name="BeforeBuild">
+ </Target>
+ <Target Name="AfterBuild">
+ </Target>
+ -->
+</Project>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/5f238d01/lang/cs/Org.Apache.REEF.IO.TestClient/Properties/AssemblyInfo.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.IO.TestClient/Properties/AssemblyInfo.cs b/lang/cs/Org.Apache.REEF.IO.TestClient/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..2bc45d5
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.IO.TestClient/Properties/AssemblyInfo.cs
@@ -0,0 +1,55 @@
+/**
+ * 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.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("Org.Apache.REEF.IO.TestClient")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("Org.Apache.REEF.IO.TestClient")]
+[assembly: AssemblyCopyright("Copyright © 2015")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("19d27f4a-8215-4737-8ffe-0709264df74d")]
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+// You can specify all the values or you can default the Build and Revision Numbers
+// by using the '*' as shown below:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("0.14.0.0")]
+[assembly: AssemblyFileVersion("0.14.0.0")]
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/5f238d01/lang/cs/Org.Apache.REEF.IO.TestClient/Run.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.IO.TestClient/Run.cs b/lang/cs/Org.Apache.REEF.IO.TestClient/Run.cs
new file mode 100644
index 0000000..5c884d8
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.IO.TestClient/Run.cs
@@ -0,0 +1,72 @@
+/**
+ * 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;
+using Org.Apache.REEF.Utilities.Logging;
+
+namespace Org.Apache.REEF.IO.TestClient
+{
+ //TODO[JIRA REEF-815]: once move to Nunit, tose test should be moved to Test project
+ /// <summary>
+ /// This purpose of this test is to run tests in Yarn envionment
+ ///
+ /// </summary>
+ public class Run
+ {
+ private static void Main(string[] args)
+ {
+ if (args.Length > 0 && args[0].Equals("p"))
+ {
+ bool result = HadoopFilePartitionTest.TestWithByteDeserializer();
+ Assert.IsTrue(result);
+ }
+
+ if (args.Length > 0 && args[0].Equals("c"))
+ {
+ HadoopFileSystemTest t = new HadoopFileSystemTest();
+ Assert.IsTrue(t.TestCopyFromRemote());
+ }
+
+ if (args.Length > 0 && args[0].Equals("b"))
+ {
+ HadoopFileSystemTest t = new HadoopFileSystemTest();
+ Assert.IsTrue(t.TestCopyFromLocalAndBack());
+ }
+ }
+ }
+
+ public static class Assert
+ {
+ private static readonly Logger Logger = Logger.GetLogger(typeof(Assert));
+
+ public static void IsTrue(bool condition, string message = null)
+ {
+ if (!condition)
+ {
+ Logger.Log(Level.Error, "Assert failed; {0}", message);
+ throw new AssertFailedException(message);
+ }
+ }
+ }
+
+ public class AssertFailedException : Exception
+ {
+ public AssertFailedException(string message) : base(message) { }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/5f238d01/lang/cs/Org.Apache.REEF.IO.Tests/Org.Apache.REEF.IO.Tests.csproj
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.IO.Tests/Org.Apache.REEF.IO.Tests.csproj b/lang/cs/Org.Apache.REEF.IO.Tests/Org.Apache.REEF.IO.Tests.csproj
index 5726329..b150829 100644
--- a/lang/cs/Org.Apache.REEF.IO.Tests/Org.Apache.REEF.IO.Tests.csproj
+++ b/lang/cs/Org.Apache.REEF.IO.Tests/Org.Apache.REEF.IO.Tests.csproj
@@ -45,6 +45,7 @@ under the License.
<ItemGroup>
<Compile Include="FileSystemTestUtilities.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
+ <Compile Include="TestFilePartitionDataSet.cs" />
<Compile Include="TestHadoopFileSystem.cs" />
<Compile Include="TestLocalFileSystem.cs" />
<Compile Include="TestRandomDataSet.cs" />
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/5f238d01/lang/cs/Org.Apache.REEF.IO.Tests/TestFilePartitionDataSet.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.IO.Tests/TestFilePartitionDataSet.cs b/lang/cs/Org.Apache.REEF.IO.Tests/TestFilePartitionDataSet.cs
new file mode 100644
index 0000000..ce5ba02
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.IO.Tests/TestFilePartitionDataSet.cs
@@ -0,0 +1,311 @@
+/**
+ * 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;
+using System.Collections.Generic;
+using System.Globalization;
+using System.IO;
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using Org.Apache.REEF.IO.PartitionedData;
+using Org.Apache.REEF.IO.PartitionedData.FileSystem;
+using Org.Apache.REEF.IO.PartitionedData.FileSystem.Parameters;
+using Org.Apache.REEF.Tang.Annotations;
+using Org.Apache.REEF.Tang.Formats;
+using Org.Apache.REEF.Tang.Implementations.Tang;
+using Org.Apache.REEF.Tang.Util;
+using Org.Apache.REEF.Utilities.Logging;
+
+namespace Org.Apache.REEF.IO.Tests
+{
+ /// <summary>
+ /// Tests for Org.Apache.REEF.IO.PartitionedData.FileSystem.
+ /// </summary>
+ [TestClass]
+ public class TestFilePartitionDataSet
+ {
+ private static readonly Logger Logger = Logger.GetLogger(typeof(TestFilePartitionDataSet));
+
+ const string tempFileName1 = "REEF.TestLocalFileSystem1.tmp";
+ const string tempFileName2 = "REEF.TestLocalFileSystem2.tmp";
+ string sourceFilePath1 = Path.Combine(Path.GetTempPath(), tempFileName1);
+ string sourceFilePath2 = Path.Combine(Path.GetTempPath(), tempFileName2);
+
+ /// <remarks>
+ /// This test creates IPartitionDataSet with FileSystemPartitionConfiguration module.
+ /// It then instantiates each IPartition using the IConfiguration provided by the IPartitionDescriptor.
+ /// </remarks>
+ [TestMethod]
+ public void TestEvaluatorSideWithMultipleFilesOnePartition()
+ {
+ MakeLocalTestFile(sourceFilePath1, new byte[] { 111, 112, 113 });
+ MakeLocalTestFile(sourceFilePath2, new byte[] { 114, 115, 116, 117 });
+
+ var dataSet = TangFactory.GetTang()
+ .NewInjector(FileSystemPartitionConfiguration<byte>.ConfigurationModule
+ .Set(FileSystemPartitionConfiguration<byte>.FilePathForPartitions, sourceFilePath1 + ";" + sourceFilePath2)
+ .Set(FileSystemPartitionConfiguration<byte>.FileSerializerConfig, GetByteSerilizerConfigString())
+ .Build())
+ .GetInstance<IPartitionedDataSet>();
+
+ Assert.AreEqual(dataSet.Count, 1);
+
+ foreach (var partitionDescriptor in dataSet)
+ {
+ var partition =
+ TangFactory.GetTang()
+ .NewInjector(partitionDescriptor.GetPartitionConfiguration())
+ .GetInstance<IPartition<IEnumerable<byte>>>();
+
+ using (partition as IDisposable)
+ {
+ Assert.IsNotNull(partition);
+ Assert.IsNotNull(partition.Id);
+ int count = 0;
+ var e = partition.GetPartitionHandle();
+ foreach (var v in e)
+ {
+ Logger.Log(Level.Info, string.Format(CultureInfo.CurrentCulture, "Data read {0}: ", v));
+ count++;
+ }
+ Assert.AreEqual(count, 7);
+ }
+ }
+ }
+
+ /// <remarks>
+ /// This test creates IPartitionDataSet using the configuration build directly.
+ /// It sets multiple files in each Partition
+ /// </remarks>
+ [TestMethod]
+ public void TestWithoutConfigurationModuleWithTwoPartitions()
+ {
+ MakeLocalTestFile(sourceFilePath1, new byte[] { 111, 112, 113 });
+ MakeLocalTestFile(sourceFilePath2, new byte[] { 114, 115, 116, 117 });
+
+ var partitionConfig = TangFactory.GetTang().NewConfigurationBuilder()
+ .BindImplementation(GenericType<IPartitionedDataSet>.Class, GenericType<FileSystemPartitionDataSet<byte>>.Class)
+ .BindStringNamedParam<FileSerializerConfigString>(GetByteSerilizerConfigString())
+ .BindSetEntry<FilePathsForPatitions, string>(GenericType<FilePathsForPatitions>.Class, sourceFilePath1)
+ .BindSetEntry<FilePathsForPatitions, string>(GenericType<FilePathsForPatitions>.Class, sourceFilePath2)
+ .Build();
+
+ var dataSet = TangFactory.GetTang()
+ .NewInjector(partitionConfig)
+ .GetInstance<IPartitionedDataSet>();
+
+ Assert.AreEqual(dataSet.Count, 2);
+
+
+ foreach (var partitionDescriptor in dataSet)
+ {
+ var partition =
+ TangFactory.GetTang()
+ .NewInjector(partitionDescriptor.GetPartitionConfiguration())
+ .GetInstance<IPartition<IEnumerable<byte>>>();
+ using (partition as IDisposable)
+ {
+ Assert.IsNotNull(partition);
+ Assert.IsNotNull(partition.Id);
+ }
+ }
+ }
+
+ /// <remarks>
+ /// This test is to use a ByteSerializer.
+ /// </remarks>
+ [TestMethod]
+ public void TestWithByteDeserializer()
+ {
+ MakeLocalTestFile(sourceFilePath1, new byte[] { 111, 112, 113 });
+ MakeLocalTestFile(sourceFilePath2, new byte[] { 114, 115, 116, 117 });
+
+ var c = TangFactory.GetTang().NewConfigurationBuilder()
+ .BindImplementation(GenericType<IPartitionedDataSet>.Class, GenericType<FileSystemPartitionDataSet<byte>>.Class)
+ .BindStringNamedParam<FileSerializerConfigString>(GetByteSerilizerConfigString())
+ .BindSetEntry<FilePathsForPatitions, string>(GenericType<FilePathsForPatitions>.Class, sourceFilePath1)
+ .BindSetEntry<FilePathsForPatitions, string>(GenericType<FilePathsForPatitions>.Class, sourceFilePath2)
+ .Build();
+
+ var dataSet = TangFactory.GetTang()
+ .NewInjector(c)
+ .GetInstance<IPartitionedDataSet>();
+
+ int count = 0;
+ foreach (var partitionDescriptor in dataSet)
+ {
+ var partition =
+ TangFactory.GetTang()
+ .NewInjector(partitionDescriptor.GetPartitionConfiguration())
+ .GetInstance<IPartition<IEnumerable<byte>>>();
+ using (partition as IDisposable)
+ {
+
+ var e = partition.GetPartitionHandle();
+ foreach (var v in e)
+ {
+ Logger.Log(Level.Info, string.Format(CultureInfo.CurrentCulture, "Data read {0}: ", v));
+ count++;
+ }
+ }
+ }
+ Assert.AreEqual(count, 7);
+ }
+
+ /// <remarks>
+ /// This test is to use a RowSerializer. Row is a class at client side.
+ /// </remarks>
+ [TestMethod]
+ public void TestWithRowDeserializer()
+ {
+ MakeLocalTestFile(sourceFilePath1, new byte[] {111, 112, 113});
+ MakeLocalTestFile(sourceFilePath2, new byte[] { 114, 115 });
+
+ var dataSet = TangFactory.GetTang()
+ .NewInjector(FileSystemPartitionConfiguration<Row>.ConfigurationModule
+ .Set(FileSystemPartitionConfiguration<Row>.FilePathForPartitions, sourceFilePath1)
+ .Set(FileSystemPartitionConfiguration<Row>.FilePathForPartitions, sourceFilePath2)
+ .Set(FileSystemPartitionConfiguration<Row>.FileSerializerConfig, GetRowSerilizerConfigString())
+ .Build())
+ .GetInstance<IPartitionedDataSet>();
+
+ int count = 0;
+ foreach (var partitionDescriptor in dataSet)
+ {
+ var partition =
+ TangFactory.GetTang()
+ .NewInjector(partitionDescriptor.GetPartitionConfiguration())
+ .GetInstance<IPartition<IEnumerable<Row>>>();
+ using (partition as IDisposable)
+ {
+ IEnumerable<Row> e = partition.GetPartitionHandle();
+
+ foreach (var row in e)
+ {
+ Logger.Log(Level.Info, string.Format(CultureInfo.CurrentCulture, "Data read {0}: ", row.GetValue()));
+ count++;
+ }
+ }
+ }
+ Assert.AreEqual(count, 5);
+ }
+
+ private void MakeLocalTestFile(string filePath, byte[] bytes)
+ {
+ if (File.Exists(filePath))
+ {
+ File.Delete(filePath);
+ }
+
+ using (var s = File.Create(filePath))
+ {
+ foreach (var b in bytes)
+ s.WriteByte(b);
+ }
+ }
+
+ private string GetByteSerilizerConfigString()
+ {
+ var serializerConf = TangFactory.GetTang().NewConfigurationBuilder()
+ .BindImplementation<IFileDeSerializer<byte>, ByteSerializer>(
+ GenericType<IFileDeSerializer<byte>>.Class,
+ GenericType<ByteSerializer>.Class)
+ .Build();
+ return (new AvroConfigurationSerializer()).ToString(serializerConf);
+ }
+
+ private string GetRowSerilizerConfigString()
+ {
+ var serializerConf = TangFactory.GetTang().NewConfigurationBuilder()
+ .BindImplementation<IFileDeSerializer<Row>, RowSerializer>(
+ GenericType<IFileDeSerializer<Row>>.Class,
+ GenericType<RowSerializer>.Class)
+ .Build();
+ return (new AvroConfigurationSerializer()).ToString(serializerConf);
+ }
+ }
+
+ public class ByteSerializer : IFileDeSerializer<byte>
+ {
+ [Inject]
+ public ByteSerializer()
+ { }
+
+ /// <summary>
+ /// Enumerate all the files in the file foder and return each byte read
+ /// </summary>
+ /// <param name="fileFolder"></param>
+ /// <returns></returns>
+ public IEnumerable<byte> Deserialize(string fileFolder)
+ {
+ foreach (var f in Directory.GetFiles(fileFolder))
+ {
+ using (FileStream stream = File.Open(f, FileMode.Open))
+ {
+ BinaryReader reader = new BinaryReader(stream);
+ while (reader.PeekChar() != -1)
+ {
+ yield return reader.ReadByte();
+ }
+ }
+ }
+ }
+ }
+
+ public class Row
+ {
+ private byte _b;
+
+ public Row(byte b)
+ {
+ _b = b;
+ }
+
+ public byte GetValue()
+ {
+ return _b;
+ }
+ }
+
+ internal class RowSerializer : IFileDeSerializer<Row>
+ {
+ [Inject]
+ private RowSerializer()
+ { }
+
+ /// <summary>
+ /// read all the files in the fileFolder cand return byte read one by one
+ /// </summary>
+ /// <param name="fileFolder"></param>
+ /// <returns></returns>
+ public IEnumerable<Row> Deserialize(string fileFolder)
+ {
+ foreach (var f in Directory.GetFiles(fileFolder))
+ {
+ using (FileStream stream = File.Open(f, FileMode.Open))
+ {
+ BinaryReader reader = new BinaryReader(stream);
+ while (reader.PeekChar() != -1)
+ {
+ yield return new Row(reader.ReadByte());
+ }
+ }
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/5f238d01/lang/cs/Org.Apache.REEF.IO.Tests/TestRandomDataSet.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.IO.Tests/TestRandomDataSet.cs b/lang/cs/Org.Apache.REEF.IO.Tests/TestRandomDataSet.cs
index 13813ba..1261214 100644
--- a/lang/cs/Org.Apache.REEF.IO.Tests/TestRandomDataSet.cs
+++ b/lang/cs/Org.Apache.REEF.IO.Tests/TestRandomDataSet.cs
@@ -17,6 +17,7 @@
* under the License.
*/
+using System.Collections.Generic;
using System.IO;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Org.Apache.REEF.IO.PartitionedData;
@@ -62,7 +63,14 @@ namespace Org.Apache.REEF.IO.Tests
Assert.IsNotNull(dataSet.Id);
Assert.IsNotNull(dataSet.GetEnumerator());
Assert.AreEqual(NumberOfPartitions, dataSet.Count);
- Assert.IsNull(dataSet.GetPartitionDescriptorForId("THIS_IS_AN_ID_THAT_CANNOT_BE_IN_THE_DATASET"));
+
+ IEnumerator<IPartitionDescriptor> desriptors = dataSet.GetEnumerator();
+ while (desriptors.MoveNext())
+ {
+ var descriptor1 = desriptors.Current;
+ var descriptor2 = dataSet.GetPartitionDescriptorForId(descriptor1.Id);
+ Assert.AreEqual(descriptor1, descriptor2);
+ }
}
/// <summary>
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/5f238d01/lang/cs/Org.Apache.REEF.IO/FileSystem/IFileSystem.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.IO/FileSystem/IFileSystem.cs b/lang/cs/Org.Apache.REEF.IO/FileSystem/IFileSystem.cs
index 31f59fd..82301c3 100644
--- a/lang/cs/Org.Apache.REEF.IO/FileSystem/IFileSystem.cs
+++ b/lang/cs/Org.Apache.REEF.IO/FileSystem/IFileSystem.cs
@@ -104,5 +104,11 @@ namespace Org.Apache.REEF.IO.FileSystem
/// <returns></returns>
/// <exception cref="IOException"></exception>
IEnumerable<Uri> GetChildren(Uri directoryUri);
+
+ /// <summary>
+ /// Returns Url prefix
+ /// </summary>
+ /// <returns></returns>
+ string UriPrefix { get; }
}
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/5f238d01/lang/cs/Org.Apache.REEF.IO/FileSystem/Local/LocalFileSystem.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.IO/FileSystem/Local/LocalFileSystem.cs b/lang/cs/Org.Apache.REEF.IO/FileSystem/Local/LocalFileSystem.cs
index 408a83f..f90c43c 100644
--- a/lang/cs/Org.Apache.REEF.IO/FileSystem/Local/LocalFileSystem.cs
+++ b/lang/cs/Org.Apache.REEF.IO/FileSystem/Local/LocalFileSystem.cs
@@ -28,9 +28,18 @@ namespace Org.Apache.REEF.IO.FileSystem.Local
/// </summary>
internal sealed class LocalFileSystem : IFileSystem
{
+ private readonly string _uriPrefix;
+
[Inject]
private LocalFileSystem()
{
+ _uriPrefix = "";
+ }
+
+ public string UriPrefix
+ {
+ get { return _uriPrefix; }
+
}
public Stream Open(Uri fileUri)
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/5f238d01/lang/cs/Org.Apache.REEF.IO/Org.Apache.REEF.IO.csproj
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.IO/Org.Apache.REEF.IO.csproj b/lang/cs/Org.Apache.REEF.IO/Org.Apache.REEF.IO.csproj
index 918b675..02968ed 100644
--- a/lang/cs/Org.Apache.REEF.IO/Org.Apache.REEF.IO.csproj
+++ b/lang/cs/Org.Apache.REEF.IO/Org.Apache.REEF.IO.csproj
@@ -52,6 +52,14 @@ under the License.
<Compile Include="FileSystem\IFileSystem.cs" />
<Compile Include="FileSystem\Local\LocalFileSystem.cs" />
<Compile Include="FileSystem\Local\LocalFileSystemConfiguration.cs" />
+ <Compile Include="PartitionedData\FileSystem\FileSystemPartition.cs" />
+ <Compile Include="PartitionedData\FileSystem\FilePartitionDescriptor.cs" />
+ <Compile Include="PartitionedData\FileSystem\Parameters\FileSerializerConfigString.cs" />
+ <Compile Include="PartitionedData\FileSystem\IFileDeSerializer.cs" />
+ <Compile Include="PartitionedData\FileSystem\FileSystemPartitionDataSet.cs" />
+ <Compile Include="PartitionedData\FileSystem\FileSystemPartitionConfiguration.cs" />
+ <Compile Include="PartitionedData\FileSystem\Parameters\FilePathsForPatitions.cs" />
+ <Compile Include="PartitionedData\FileSystem\Parameters\FilePathsInPartition.cs" />
<Compile Include="PartitionedData\IPartition.cs" />
<Compile Include="PartitionedData\IPartitionDescriptor.cs" />
<Compile Include="PartitionedData\IPartitionedDataSet.cs" />
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/5f238d01/lang/cs/Org.Apache.REEF.IO/PartitionedData/FileSystem/FilePartitionDescriptor.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.IO/PartitionedData/FileSystem/FilePartitionDescriptor.cs b/lang/cs/Org.Apache.REEF.IO/PartitionedData/FileSystem/FilePartitionDescriptor.cs
new file mode 100644
index 0000000..9b77783
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.IO/PartitionedData/FileSystem/FilePartitionDescriptor.cs
@@ -0,0 +1,68 @@
+/**
+ * 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;
+using System.Collections.Generic;
+using Org.Apache.REEF.IO.PartitionedData.FileSystem.Parameters;
+using Org.Apache.REEF.IO.PartitionedData.Random.Parameters;
+using Org.Apache.REEF.Tang.Implementations.Configuration;
+using Org.Apache.REEF.Tang.Implementations.Tang;
+using Org.Apache.REEF.Tang.Interface;
+using Org.Apache.REEF.Tang.Util;
+
+namespace Org.Apache.REEF.IO.PartitionedData.FileSystem
+{
+ internal sealed class FilePartitionDescriptor<T> : IPartitionDescriptor
+ {
+ private readonly string _id;
+ private readonly IList<string> _filePaths;
+ private readonly IConfiguration _filePartitionDeserializerConfig;
+
+ internal FilePartitionDescriptor(string id, IList<string> filePaths, IConfiguration filePartitionDeserializerConfig)
+ {
+ _id = id;
+ _filePaths = filePaths;
+ _filePartitionDeserializerConfig = filePartitionDeserializerConfig;
+ }
+
+ public string Id
+ {
+ get { return _id; }
+ }
+
+ /// <summary>
+ /// This method is to provide Configurations required to inject the corresponding IPartition.
+ /// </summary>
+ /// <returns></returns>
+ public IConfiguration GetPartitionConfiguration()
+ {
+ var builder = TangFactory.GetTang().NewConfigurationBuilder()
+ .BindImplementation(GenericType<IPartition<IEnumerable<T>>>.Class, GenericType<FileSystemPartition<T>>.Class)
+ .BindStringNamedParam<PartitionId>(_id);
+
+ foreach (string p in _filePaths)
+ {
+ builder = builder.BindSetEntry<FilePathsInPartition, string>
+ (GenericType<FilePathsInPartition>.Class, p);
+ }
+
+ return Configurations.Merge(builder.Build(), _filePartitionDeserializerConfig);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/5f238d01/lang/cs/Org.Apache.REEF.IO/PartitionedData/FileSystem/FileSystemPartition.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.IO/PartitionedData/FileSystem/FileSystemPartition.cs b/lang/cs/Org.Apache.REEF.IO/PartitionedData/FileSystem/FileSystemPartition.cs
new file mode 100644
index 0000000..aeeeb7b
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.IO/PartitionedData/FileSystem/FileSystemPartition.cs
@@ -0,0 +1,148 @@
+/**
+ * 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;
+using System.Collections.Generic;
+using System.Globalization;
+using System.IO;
+using Org.Apache.REEF.IO.FileSystem;
+using Org.Apache.REEF.IO.PartitionedData.FileSystem.Parameters;
+using Org.Apache.REEF.IO.PartitionedData.Random.Parameters;
+using Org.Apache.REEF.Tang.Annotations;
+using Org.Apache.REEF.Utilities.Diagnostics;
+using Org.Apache.REEF.Utilities.Logging;
+
+namespace Org.Apache.REEF.IO.PartitionedData.FileSystem
+{
+ internal sealed class FileSystemPartition<T> : IPartition<IEnumerable<T>>, IDisposable
+ {
+ private static readonly Logger Logger = Logger.GetLogger(typeof(FileSystemPartition<T>));
+
+ private readonly string _id;
+ private readonly IFileSystem _fileSystem;
+ private readonly IFileDeSerializer<T> _fileSerializer;
+ private readonly ISet<string> _filePaths;
+ private bool _isInitialized;
+ private readonly object _lock = new object();
+ private string _localFileFolder;
+
+ [Inject]
+ private FileSystemPartition([Parameter(typeof (PartitionId))] string id,
+ [Parameter(typeof (FilePathsInPartition))] ISet<string> filePaths,
+ IFileSystem fileSystem,
+ IFileDeSerializer<T> fileSerializer)
+ {
+ _id = id;
+ _fileSystem = fileSystem;
+ _fileSerializer = fileSerializer;
+ _filePaths = filePaths;
+ _isInitialized = false;
+ }
+
+ public string Id
+ {
+ get { return _id; }
+ }
+
+ private void Initialize()
+ {
+ lock (_lock)
+ {
+ if (!_isInitialized)
+ {
+ CopyFromRemote();
+ _isInitialized = true;
+ }
+ }
+ }
+
+ /// <summary>
+ /// This method copy remote files to local and then deserialize the files.
+ /// It returns the IEnumerble of T, the details is defined in the Deserialize() method
+ /// provided by the Serializer
+ /// </summary>
+ /// <returns></returns>
+ public IEnumerable<T> GetPartitionHandle()
+ {
+ if (!_isInitialized)
+ {
+ Initialize();
+ }
+ return _fileSerializer.Deserialize(_localFileFolder);
+ }
+
+ private void CopyFromRemote()
+ {
+ _localFileFolder = Path.GetTempPath() + "-partition-" + Guid.NewGuid().ToString("N").Substring(0, 8);
+ Directory.CreateDirectory(_localFileFolder);
+
+ foreach (var sourceFilePath in _filePaths)
+ {
+ Uri sourceUri = new Uri(_fileSystem.UriPrefix + sourceFilePath);
+ Logger.Log(Level.Info, string.Format
+ (CultureInfo.CurrentCulture, "sourceUri {0}: ", sourceUri));
+ if (!_fileSystem.Exists(sourceUri))
+ {
+ throw new FileNotFoundException(string.Format(CultureInfo.CurrentCulture,
+ "Remote File {0} does not exists.", sourceUri));
+ }
+
+ var localFilePath = _localFileFolder + "\\" + Guid.NewGuid().ToString("N").Substring(0, 8);
+ Logger.Log(Level.Info, string.Format
+ (CultureInfo.CurrentCulture, "localFilePath {0}: ", localFilePath));
+ if (File.Exists(localFilePath))
+ {
+ File.Delete(localFilePath);
+ Logger.Log(Level.Warning, "localFile already exists, delete it: " + localFilePath);
+ }
+
+ _fileSystem.CopyToLocal(sourceUri, localFilePath);
+ if (File.Exists(localFilePath))
+ {
+ Logger.Log(Level.Info, string.Format
+ (CultureInfo.CurrentCulture, "File {0} is Copied to local {1}.", sourceUri, localFilePath));
+ }
+ else
+ {
+ string msg = string.Format
+ (CultureInfo.CurrentCulture, "File {0} is NOT Copied to local {1}.", sourceUri, localFilePath);
+ Exceptions.Throw(new FileLoadException(), msg, Logger);
+ }
+ }
+ }
+
+ /// <summary>
+ /// Implementation of the IDisposable.
+ /// The caller should use using pattern and this method will be
+ /// called automatically when the object is out of scope.
+ /// </summary>
+ public void Dispose()
+ {
+ if (_localFileFolder != null)
+ {
+ foreach (var fileName in Directory.GetFiles(_localFileFolder))
+ {
+ File.Delete(fileName);
+ }
+ Directory.Delete(_localFileFolder);
+ _localFileFolder = null;
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/5f238d01/lang/cs/Org.Apache.REEF.IO/PartitionedData/FileSystem/FileSystemPartitionConfiguration.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.IO/PartitionedData/FileSystem/FileSystemPartitionConfiguration.cs b/lang/cs/Org.Apache.REEF.IO/PartitionedData/FileSystem/FileSystemPartitionConfiguration.cs
new file mode 100644
index 0000000..3517303
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.IO/PartitionedData/FileSystem/FileSystemPartitionConfiguration.cs
@@ -0,0 +1,53 @@
+/**
+ * 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.IO.PartitionedData.FileSystem.Parameters;
+using Org.Apache.REEF.Tang.Formats;
+using Org.Apache.REEF.Tang.Util;
+
+namespace Org.Apache.REEF.IO.PartitionedData.FileSystem
+{
+ /// <summary>
+ /// This configuration module set FileSystemDataSet as IPartitionedDataSet.
+ /// It also set required parameters for injecting FileSystemDataSet
+ /// </summary>
+ /// <typeparam name="T"></typeparam>
+ public sealed class FileSystemPartitionConfiguration<T> : ConfigurationModuleBuilder
+ {
+ /// <summary>
+ /// This parameter contains file paths required for file partition dataset
+ /// </summary>
+ public static readonly RequiredParameter<string> FilePathForPartitions = new RequiredParameter<string>();
+
+ /// <summary>
+ /// This is serialized configuration for ISerializer
+ /// </summary>
+ public static readonly RequiredParameter<string> FileSerializerConfig = new RequiredParameter<string>();
+
+ /// <summary>
+ /// This configuration module set FileSystemDataSet as IPartitionedDataSet.
+ /// It also set required parameters for injecting FileSystemDataSet
+ /// </summary>
+ public static ConfigurationModule ConfigurationModule = new FileSystemPartitionConfiguration<T>()
+ .BindImplementation(GenericType<IPartitionedDataSet>.Class, GenericType<FileSystemPartitionDataSet<T>>.Class)
+ .BindSetEntry(GenericType<FilePathsForPatitions>.Class, FilePathForPartitions)
+ .BindNamedParameter(GenericType<FileSerializerConfigString>.Class, FileSerializerConfig)
+ .Build();
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/5f238d01/lang/cs/Org.Apache.REEF.IO/PartitionedData/FileSystem/FileSystemPartitionDataSet.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.IO/PartitionedData/FileSystem/FileSystemPartitionDataSet.cs b/lang/cs/Org.Apache.REEF.IO/PartitionedData/FileSystem/FileSystemPartitionDataSet.cs
new file mode 100644
index 0000000..5ec53e9
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.IO/PartitionedData/FileSystem/FileSystemPartitionDataSet.cs
@@ -0,0 +1,138 @@
+/**
+ * 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;
+using System.Collections.Generic;
+using System.Collections;
+using System.IO;
+using System.Linq;
+using Org.Apache.REEF.IO.FileSystem;
+using Org.Apache.REEF.IO.PartitionedData.FileSystem.Parameters;
+using Org.Apache.REEF.Tang.Annotations;
+using Org.Apache.REEF.Tang.Formats;
+using Org.Apache.REEF.Tang.Implementations.Configuration;
+using Org.Apache.REEF.Tang.Implementations.Tang;
+using Org.Apache.REEF.Tang.Interface;
+
+namespace Org.Apache.REEF.IO.PartitionedData.FileSystem
+{
+ /// <summary>
+ /// This class is an implementation of IPartitionedDataSet for FileSystem.
+ /// It requires the client to provide configuration for FileSerializer
+ /// T is a type for data, e.g. a class like Row, or int, byte
+ /// </summary>
+ /// <typeparam name="T"></typeparam>
+ internal sealed class FileSystemPartitionDataSet<T> : IPartitionedDataSet
+ {
+ private readonly Dictionary<string, IPartitionDescriptor> _partitions;
+ private readonly int _count ;
+ private const string StringSeparators = ";";
+ private const string IdPrefix = "FileSystemDataSet-";
+ private readonly string _id;
+
+ [Inject]
+ private FileSystemPartitionDataSet(
+ [Parameter(typeof(FilePathsForPatitions))] ISet<string> filePaths,
+ IFileSystem fileSystem,
+ [Parameter(typeof(FileSerializerConfigString))] string fileSerializerConfigString,
+ AvroConfigurationSerializer avroConfigurationSerializer
+ )
+ {
+ _count = filePaths.Count;
+ _id = FormId(filePaths);
+ _partitions = new Dictionary<string, IPartitionDescriptor>(_count);
+
+ var fileSerializerConfig =
+ avroConfigurationSerializer.FromString(fileSerializerConfigString);
+
+ int i = 0;
+ foreach (var path in filePaths)
+ {
+ var paths = path.Split(new string[] { StringSeparators }, StringSplitOptions.None);
+
+ var id = "FilePartition-" + i++;
+ _partitions[id] = new FilePartitionDescriptor<T>(id, paths.ToList(), fileSerializerConfig);
+ }
+ }
+
+ /// <summary>
+ /// It returns the number of partions in the data set
+ /// </summary>
+ public int Count
+ {
+ get { return _count; }
+ }
+
+ /// <summary>
+ /// It returns the id of the file system data set
+ /// </summary>
+ public string Id
+ {
+ get { return _id; }
+ }
+
+ /// <summary>
+ /// It returns Partition Descriptor by given id
+ /// If id doesn't exists, it is callers responsibility to catch and handle exception
+ /// </summary>
+ /// <param name="partitionId"></param>
+ /// <returns></returns>
+ public IPartitionDescriptor GetPartitionDescriptorForId(string partitionId)
+ {
+ return _partitions[partitionId];
+ }
+
+ /// <summary>
+ /// Returns IEnumerator of IPartitionDescriptor
+ /// </summary>
+ /// <returns></returns>
+ public IEnumerator<IPartitionDescriptor> GetEnumerator()
+ {
+ return _partitions.Values.GetEnumerator();
+ }
+
+ /// <summary>
+ /// Returns IEnumerator of IPartitionDescriptor in the partitions
+ /// </summary>
+ /// <returns></returns>
+ IEnumerator IEnumerable.GetEnumerator()
+ {
+ return _partitions.Values.GetEnumerator();
+ }
+
+ private string FormId(ISet<string> filePaths)
+ {
+ string id = "";
+ if (filePaths != null && filePaths.Count > 0)
+ {
+ var path = filePaths.First();
+ var paths = path.Split(new string[] {StringSeparators}, StringSplitOptions.None);
+ if (paths.Length > 0)
+ {
+ FileInfo fInfo = new FileInfo(paths[0]);
+ if (fInfo.Directory != null)
+ {
+ id = fInfo.Directory.Name;
+ }
+ }
+ }
+ return IdPrefix + id;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/5f238d01/lang/cs/Org.Apache.REEF.IO/PartitionedData/FileSystem/IFileDeSerializer.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.IO/PartitionedData/FileSystem/IFileDeSerializer.cs b/lang/cs/Org.Apache.REEF.IO/PartitionedData/FileSystem/IFileDeSerializer.cs
new file mode 100644
index 0000000..88b8c10
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.IO/PartitionedData/FileSystem/IFileDeSerializer.cs
@@ -0,0 +1,39 @@
+/**
+ * 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;
+
+namespace Org.Apache.REEF.IO.PartitionedData.FileSystem
+{
+ /// <summary>
+ /// A interface for user to implement its deserializer.
+ /// </summary>
+ /// <typeparam name="T"></typeparam>
+ public interface IFileDeSerializer<T>
+ {
+ /// <summary>
+ /// The input is a file folder which contains all input files in one partition.
+ /// The output is an IEnumerable of T which is defined by the client
+ /// If there is any IO error, IOException could be thrown.
+ /// </summary>
+ /// <param name="fileFolder"></param>
+ /// <returns></returns>
+ IEnumerable<T> Deserialize(string fileFolder);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/5f238d01/lang/cs/Org.Apache.REEF.IO/PartitionedData/FileSystem/Parameters/FilePathsForPatitions.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.IO/PartitionedData/FileSystem/Parameters/FilePathsForPatitions.cs b/lang/cs/Org.Apache.REEF.IO/PartitionedData/FileSystem/Parameters/FilePathsForPatitions.cs
new file mode 100644
index 0000000..b024597
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.IO/PartitionedData/FileSystem/Parameters/FilePathsForPatitions.cs
@@ -0,0 +1,33 @@
+/**
+ * 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 Org.Apache.REEF.Tang.Annotations;
+
+namespace Org.Apache.REEF.IO.PartitionedData.FileSystem.Parameters
+{
+ /// <summary>
+ /// Each element in the set contains input files for one partition, seperated by semicolon.
+ /// The set contains file paths for all the partitions
+ /// </summary>
+ [NamedParameter("All file paths")]
+ internal sealed class FilePathsForPatitions : Name<ISet<string>>
+ {
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/5f238d01/lang/cs/Org.Apache.REEF.IO/PartitionedData/FileSystem/Parameters/FilePathsInPartition.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.IO/PartitionedData/FileSystem/Parameters/FilePathsInPartition.cs b/lang/cs/Org.Apache.REEF.IO/PartitionedData/FileSystem/Parameters/FilePathsInPartition.cs
new file mode 100644
index 0000000..8ecb495
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.IO/PartitionedData/FileSystem/Parameters/FilePathsInPartition.cs
@@ -0,0 +1,32 @@
+/**
+ * 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 Org.Apache.REEF.Tang.Annotations;
+
+namespace Org.Apache.REEF.IO.PartitionedData.FileSystem.Parameters
+{
+ /// <summary>
+ /// This set contains the filepaths in one partition
+ /// </summary>
+ [NamedParameter("File paths for a partition")]
+ internal sealed class FilePathsInPartition : Name<ISet<string>>
+ {
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/5f238d01/lang/cs/Org.Apache.REEF.IO/PartitionedData/FileSystem/Parameters/FileSerializerConfigString.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.IO/PartitionedData/FileSystem/Parameters/FileSerializerConfigString.cs b/lang/cs/Org.Apache.REEF.IO/PartitionedData/FileSystem/Parameters/FileSerializerConfigString.cs
new file mode 100644
index 0000000..159e1ec
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.IO/PartitionedData/FileSystem/Parameters/FileSerializerConfigString.cs
@@ -0,0 +1,28 @@
+/**
+ * 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.Tang.Annotations;
+
+namespace Org.Apache.REEF.IO.PartitionedData.FileSystem.Parameters
+{
+ [NamedParameter("File serializer serialized configuration")]
+ internal sealed class FileSerializerConfigString : Name<string>
+ {
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/5f238d01/lang/cs/Org.Apache.REEF.IO/PartitionedData/IPartition.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.IO/PartitionedData/IPartition.cs b/lang/cs/Org.Apache.REEF.IO/PartitionedData/IPartition.cs
index c0e6799..75a5610 100644
--- a/lang/cs/Org.Apache.REEF.IO/PartitionedData/IPartition.cs
+++ b/lang/cs/Org.Apache.REEF.IO/PartitionedData/IPartition.cs
@@ -17,7 +17,7 @@
* under the License.
*/
-using System.IO;
+using System;
namespace Org.Apache.REEF.IO.PartitionedData
{
@@ -26,7 +26,7 @@ namespace Org.Apache.REEF.IO.PartitionedData
/// </summary>
/// <typeparam name="T">Generic Type representing data pointer.
/// For example, for data in local file it can be file pointer </typeparam>
- public interface IPartition<T>
+ public interface IPartition<T>
{
/// <summary>
/// The id of the partition.
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/5f238d01/lang/cs/Org.Apache.REEF.IO/PartitionedData/Random/RandomDataSet.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.IO/PartitionedData/Random/RandomDataSet.cs b/lang/cs/Org.Apache.REEF.IO/PartitionedData/Random/RandomDataSet.cs
index 7eb74b6..794213a 100644
--- a/lang/cs/Org.Apache.REEF.IO/PartitionedData/Random/RandomDataSet.cs
+++ b/lang/cs/Org.Apache.REEF.IO/PartitionedData/Random/RandomDataSet.cs
@@ -66,14 +66,7 @@ namespace Org.Apache.REEF.IO.PartitionedData.Random
public IPartitionDescriptor GetPartitionDescriptorForId(string partitionId)
{
- try
- {
- return _partitions[partitionId];
- }
- catch (KeyNotFoundException)
- {
- return null;
- }
+ return _partitions[partitionId];
}
}
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/5f238d01/lang/cs/Org.Apache.REEF.IO/Properties/AssemblyInfo.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.IO/Properties/AssemblyInfo.cs b/lang/cs/Org.Apache.REEF.IO/Properties/AssemblyInfo.cs
index 0b9d827..e8641d5 100644
--- a/lang/cs/Org.Apache.REEF.IO/Properties/AssemblyInfo.cs
+++ b/lang/cs/Org.Apache.REEF.IO/Properties/AssemblyInfo.cs
@@ -39,3 +39,8 @@ using System.Runtime.InteropServices;
"9c03469d0f93a9f5d45aa2c883f50cd158759e93673f759ec4657fd84cc79d2db38ef1a2d914cc" +
"b7c717846a897e11dd22eb260a7ce2da2dccf0263ea63e2b3f7dac24f28882aa568ef544341d17" +
"618392a1095f4049ad079d4f4f0b429bb535699155fd6a7652ec7d6c1f1ba2b560f11ef3a86b5945d288cf")]
+[assembly: InternalsVisibleTo("Org.Apache.REEF.IO.TestClient, publickey=" +
+ "00240000048000009400000006020000002400005253413100040000010001005df3e621d886a9" +
+ "9c03469d0f93a9f5d45aa2c883f50cd158759e93673f759ec4657fd84cc79d2db38ef1a2d914cc" +
+ "b7c717846a897e11dd22eb260a7ce2da2dccf0263ea63e2b3f7dac24f28882aa568ef544341d17" +
+ "618392a1095f4049ad079d4f4f0b429bb535699155fd6a7652ec7d6c1f1ba2b560f11ef3a86b5945d288cf")]
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/5f238d01/lang/cs/Org.Apache.REEF.sln
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.sln b/lang/cs/Org.Apache.REEF.sln
index c8720d9..06b4bfa 100644
Binary files a/lang/cs/Org.Apache.REEF.sln and b/lang/cs/Org.Apache.REEF.sln differ