Repository: reef
Updated Branches:
  refs/heads/master 23d9b960a -> 3d1411d7d


[REEF-1892] Revert REEF-1827

This reverts the changes of REEF-1827 as they created compatibility issues with
common HDFS clusters.

Note: this is the first of multiple commits associated with REEF-1892.

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

Pull Request:
  This closes #1383


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

Branch: refs/heads/master
Commit: 3d1411d7dfcd959025cdfef2e7e1fb60dad050de
Parents: 23d9b96
Author: Shouheng Yi <[email protected]>
Authored: Wed Sep 27 13:27:28 2017 -0700
Committer: Markus Weimer <[email protected]>
Committed: Tue Oct 10 18:59:21 2017 +0200

----------------------------------------------------------------------
 .../FileSystem/Hadoop/HadoopFileSystem.cs       | 28 +++++++-------------
 1 file changed, 10 insertions(+), 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/reef/blob/3d1411d7/lang/cs/Org.Apache.REEF.IO/FileSystem/Hadoop/HadoopFileSystem.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.IO/FileSystem/Hadoop/HadoopFileSystem.cs 
b/lang/cs/Org.Apache.REEF.IO/FileSystem/Hadoop/HadoopFileSystem.cs
index a38e547..f7f8274 100644
--- a/lang/cs/Org.Apache.REEF.IO/FileSystem/Hadoop/HadoopFileSystem.cs
+++ b/lang/cs/Org.Apache.REEF.IO/FileSystem/Hadoop/HadoopFileSystem.cs
@@ -69,16 +69,8 @@ namespace Org.Apache.REEF.IO.FileSystem.Hadoop
             }
 
             Uri uri;
-            try
-            {
-                uri = new Uri(path);
-                Logger.Log(Level.Info, 
string.Format(CultureInfo.CurrentCulture, "Uri {0} created in 
CreateUriForPath.", uri.AbsolutePath));
-            }
-            catch (UriFormatException)
-            {
-                uri = new Uri(_uriPrefix + path);
-                Logger.Log(Level.Info, 
string.Format(CultureInfo.CurrentCulture, "Uri {0} created in CreateUriForPath 
with prefix added.", uri.AbsolutePath));
-            }
+            uri = new Uri(path);
+            Logger.Log(Level.Info, string.Format(CultureInfo.CurrentCulture, 
"Uri {0} created in CreateUriForPath.", uri));
 
             return uri;
         }
@@ -118,7 +110,7 @@ namespace Org.Apache.REEF.IO.FileSystem.Hadoop
         public void Delete(Uri fileUri)
         {
             // Delete the file via the hdfs command line.
-            _commandRunner.Run("dfs -rm " + fileUri.AbsolutePath);
+            _commandRunner.Run("dfs -rm " + fileUri);
         }
 
         public bool Exists(Uri fileUri)
@@ -126,38 +118,38 @@ namespace Org.Apache.REEF.IO.FileSystem.Hadoop
             // This determines the existence of a file based on the 'ls' 
command. 
             // Ideally, we'd use the 'test' command's return value, but we did 
not find a way to access that.
             return
-                _commandRunner.Run("dfs -ls " + fileUri.AbsolutePath).StdErr
+                _commandRunner.Run("dfs -ls " + fileUri).StdErr
                     .All(line => !NoSuchFileOrDirectoryRegEx.IsMatch(line));
         }
 
         public void Copy(Uri sourceUri, Uri destinationUri)
         {
-            _commandRunner.Run("dfs -cp " + sourceUri.AbsolutePath + " " + 
destinationUri.AbsolutePath);
+            _commandRunner.Run("dfs -cp " + sourceUri + " " + destinationUri);
         }
 
         public void CopyToLocal(Uri remoteFileUri, string localName)
         {
-            _commandRunner.Run("dfs -get " + remoteFileUri.AbsolutePath + " " 
+ localName);
+            _commandRunner.Run("dfs -get " + remoteFileUri + " " + localName);
         }
 
         public void CopyFromLocal(string localFileName, Uri remoteFileUri)
         {
-            _commandRunner.Run("dfs -put " + localFileName + " " + 
remoteFileUri.AbsolutePath);
+            _commandRunner.Run("dfs -put " + localFileName + " " + 
remoteFileUri);
         }
 
         public void CreateDirectory(Uri directoryUri)
         {
-            _commandRunner.Run("dfs -mkdir " + directoryUri.AbsolutePath);
+            _commandRunner.Run("dfs -mkdir " + directoryUri);
         }
 
         public void DeleteDirectory(Uri directoryUri)
         {
-            _commandRunner.Run("dfs -rmdir " + directoryUri.AbsolutePath);
+            _commandRunner.Run("dfs -rmdir " + directoryUri);
         }
 
         public IEnumerable<Uri> GetChildren(Uri directoryUri)
         {
-            return _commandRunner.Run("dfs -ls " + directoryUri.AbsolutePath)
+            return _commandRunner.Run("dfs -ls " + directoryUri)
                 .StdOut.Where(line => !LsFirstLineRegex.IsMatch(line))
                 .Select(line => line.Split())
                 .Select(x => new Uri(x[x.Length - 1]));

Reply via email to