You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@twill.apache.org by ch...@apache.org on 2017/01/28 01:51:56 UTC

twill git commit: TWILL-210 Ability to handle FileSystems that do not have authority

Repository: twill
Updated Branches:
  refs/heads/master 2f1032100 -> 3fed2c09e


TWILL-210 Ability to handle FileSystems that do not have authority

This closes #28 on Github.

Signed-off-by: Terence Yim <ch...@apache.org>


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

Branch: refs/heads/master
Commit: 3fed2c09eddffab67ca1909c7b3e2bcc9a2c7727
Parents: 2f10321
Author: Yuliya Feldman <yu...@dremio.com>
Authored: Fri Jan 27 14:49:58 2017 -0800
Committer: Terence Yim <ch...@apache.org>
Committed: Fri Jan 27 17:51:46 2017 -0800

----------------------------------------------------------------------
 .../main/java/org/apache/twill/internal/ServiceMain.java    | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/twill/blob/3fed2c09/twill-yarn/src/main/java/org/apache/twill/internal/ServiceMain.java
----------------------------------------------------------------------
diff --git a/twill-yarn/src/main/java/org/apache/twill/internal/ServiceMain.java b/twill-yarn/src/main/java/org/apache/twill/internal/ServiceMain.java
index 91256c8..727435c 100644
--- a/twill-yarn/src/main/java/org/apache/twill/internal/ServiceMain.java
+++ b/twill-yarn/src/main/java/org/apache/twill/internal/ServiceMain.java
@@ -147,7 +147,14 @@ public abstract class ServiceMain {
         @Override
         public Location run() throws Exception {
           Configuration hConf = new Configuration(conf);
-          URI defaultURI = new URI(appDir.getScheme(), appDir.getAuthority(), null, null, null);
+          final URI defaultURI;
+          if (appDir.getAuthority() == null || appDir.getAuthority().isEmpty()) {
+            // some FileSystems do not have authority. E.g. maprfs or s3 (similar to file:///)
+            // need to handle URI differently for those
+            defaultURI = new URI(appDir.getScheme(), "", "/", null, null);
+          } else {
+            defaultURI = new URI(appDir.getScheme(), appDir.getAuthority(), null, null, null);
+          }
           hConf.set(CommonConfigurationKeysPublic.FS_DEFAULT_NAME_KEY, defaultURI.toString());
           return new FileContextLocationFactory(hConf).create(appDir);
         }