[ARVADOS] created: 1.1.4-1-g1f15c5b

Git user git at public.curoverse.com
Tue Apr 10 09:42:20 EDT 2018


        at  1f15c5b6060b0d82c9b17fb724b7128374f65747 (commit)


commit 1f15c5b6060b0d82c9b17fb724b7128374f65747
Author: Fuad Muhic <muhic.fuad at gmail.com>
Date:   Tue Apr 10 15:40:13 2018 +0200

    Arvados projects can be accessed from by_id directory in keep mount
    
    Arvados-DCO-1.1-Signed-off-by: Fuad Muhic <fmuhic at capeannenterprises.com>

diff --git a/services/fuse/arvados_fuse/fusedir.py b/services/fuse/arvados_fuse/fusedir.py
index 34fd594..f4ff6c9 100644
--- a/services/fuse/arvados_fuse/fusedir.py
+++ b/services/fuse/arvados_fuse/fusedir.py
@@ -609,12 +609,13 @@ class MagicDirectory(Directory):
     README_TEXT = """
 This directory provides access to Arvados collections as subdirectories listed
 by uuid (in the form 'zzzzz-4zz18-1234567890abcde') or portable data hash (in
-the form '1234567890abcdef0123456789abcdef+123').
+the form '1234567890abcdef0123456789abcdef+123'), and Arvados projects by uuid
+(in the form 'zzzzz-j7d0g-1234567890abcde').
 
 Note that this directory will appear empty until you attempt to access a
-specific collection subdirectory (such as trying to 'cd' into it), at which
-point the collection will actually be looked up on the server and the directory
-will appear if it exists.
+specific collection or project subdirectory (such as trying to 'cd' into it),
+at which point the collection or project will actually be looked up on the server
+and the directory will appear if it exists.
 
 """.lstrip()
 
@@ -645,8 +646,15 @@ will appear if it exists.
 
         try:
             e = None
-            e = self.inodes.add_entry(CollectionDirectory(
-                    self.inode, self.inodes, self.api, self.num_retries, k))
+
+            if group_uuid_pattern.match(k):
+                project_object = self.api.groups().get(
+                    uuid=k).execute(num_retries=self.num_retries)
+                e = self.inodes.add_entry(ProjectDirectory(
+                    self.inode, self.inodes, self.api, self.num_retries, project_object))
+            else:
+                e = self.inodes.add_entry(CollectionDirectory(
+                        self.inode, self.inodes, self.api, self.num_retries, k))
 
             if e.update():
                 if k not in self._entries:
@@ -829,7 +837,7 @@ class ProjectDirectory(Directory):
             self.inodes.add_entry(self.project_object_file)
 
         if not self._full_listing:
-            return
+            return True
 
         def samefn(a, i):
             if isinstance(a, CollectionDirectory) or isinstance(a, ProjectDirectory):
@@ -865,6 +873,7 @@ class ProjectDirectory(Directory):
                        self.namefn,
                        samefn,
                        self.createDirectory)
+            return True
         finally:
             self._updating_lock.release()
 
diff --git a/services/fuse/tests/test_mount.py b/services/fuse/tests/test_mount.py
index 7ee20f0..33a4ca5 100644
--- a/services/fuse/tests/test_mount.py
+++ b/services/fuse/tests/test_mount.py
@@ -121,6 +121,9 @@ class FuseMagicTest(MountTestBase):
     def setUp(self, api=None):
         super(FuseMagicTest, self).setUp(api=api)
 
+        self.test_project = run_test_server.fixture('groups')['aproject']['uuid']
+        self.collection_in_test_project = run_test_server.fixture('collections')['foo_collection_in_aproject']['name']
+
         cw = arvados.CollectionWriter()
 
         cw.start_new_file('thing1.txt')
@@ -139,15 +142,23 @@ class FuseMagicTest(MountTestBase):
         self.assertFalse(any(arvados.util.keep_locator_pattern.match(fn) or
                              arvados.util.uuid_pattern.match(fn)
                              for fn in mount_ls),
-                         "new FUSE MagicDirectory lists Collection")
+                         "new FUSE MagicDirectory has no collections or projects")
         self.assertDirContents(self.testcollection, ['thing1.txt'])
         self.assertDirContents(os.path.join('by_id', self.testcollection),
                                ['thing1.txt'])
+        self.assertIn(self.collection_in_test_project,
+                      llfuse.listdir(os.path.join(self.mounttmp, self.test_project)))
+        self.assertIn(self.collection_in_test_project,
+                      llfuse.listdir(os.path.join(self.mounttmp, 'by_id', self.test_project)))
+
         mount_ls = llfuse.listdir(self.mounttmp)
         self.assertIn('README', mount_ls)
         self.assertIn(self.testcollection, mount_ls)
         self.assertIn(self.testcollection,
                       llfuse.listdir(os.path.join(self.mounttmp, 'by_id')))
+        self.assertIn(self.test_project, mount_ls)
+        self.assertIn(self.test_project, 
+                      llfuse.listdir(os.path.join(self.mounttmp, 'by_id')))
 
         files = {}
         files[os.path.join(self.mounttmp, self.testcollection, 'thing1.txt')] = 'data 1'

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list