[ARVADOS] created: 701c816ee3d87b7064cdced3a3c11befd3867a3f

git at public.curoverse.com git at public.curoverse.com
Thu Aug 28 15:11:26 EDT 2014


        at  701c816ee3d87b7064cdced3a3c11befd3867a3f (commit)


commit 701c816ee3d87b7064cdced3a3c11befd3867a3f
Author: Peter Amstutz <peter.amstutz at curoverse.com>
Date:   Thu Aug 28 15:11:02 2014 -0400

    3644: More renaming GroupDirectory to ProjectDirectory, removing name links.

diff --git a/services/fuse/arvados_fuse/__init__.py b/services/fuse/arvados_fuse/__init__.py
index b69abda..a2a5166 100644
--- a/services/fuse/arvados_fuse/__init__.py
+++ b/services/fuse/arvados_fuse/__init__.py
@@ -260,7 +260,7 @@ class TagsDirectory(Directory):
         tags = self.api.links().list(filters=[['link_class', '=', 'tag']], select=['name'], distinct = True).execute()
         if "items" in tags:
             self.merge(tags['items'],
-                       lambda i: i['name'],
+                       lambda i: i['name'] if 'name' in i else i['uuid'],
                        lambda a, i: a.tag == i,
                        lambda i: TagDirectory(self.inode, self.inodes, self.api, i['name'], poll=self._poll, poll_time=self._poll_time))
 
@@ -320,7 +320,7 @@ class ProjectDirectory(Directory):
     '''A special directory that contains the contents of a project.'''
 
     def __init__(self, parent_inode, inodes, api, uuid, poll=False, poll_time=60):
-        super(GroupDirectory, self).__init__(parent_inode)
+        super(ProjectDirectory, self).__init__(parent_inode)
         self.inodes = inodes
         self.api = api
         self.uuid = uuid['uuid']
@@ -329,42 +329,33 @@ class ProjectDirectory(Directory):
 
     def invalidate(self):
         with llfuse.lock:
-            super(GroupDirectory, self).invalidate()
+            super(ProjectDirectory, self).invalidate()
             for a in self._entries:
                 self._entries[a].invalidate()
 
     def createDirectory(self, i):
-        if re.match(r'[0-9a-f]{32}\+\d+', i['uuid']):
+        if re.match(r'[a-z0-9]{5}-4zz18-[a-z0-9]{15}', i['uuid']):
             return CollectionDirectory(self.inode, self.inodes, i['uuid'])
         elif re.match(r'[a-z0-9]{5}-j7d0g-[a-z0-9]{15}', i['uuid']):
-            return GroupDirectory(self.parent_inode, self.inodes, self.api, i, self._poll, self._poll_time)
+            return ProjectDirectory(self.parent_inode, self.inodes, self.api, i, self._poll, self._poll_time)
         elif re.match(r'[a-z0-9]{5}-[a-z0-9]{5}-[a-z0-9]{15}', i['uuid']):
             return ObjectFile(self.parent_inode, i)
         return None
 
     def update(self):
-        contents = self.api.groups().contents(uuid=self.uuid, include_linked=True).execute()
-        links = {}
-        for a in contents['links']:
-            links[a['head_uuid']] = a['name']
-
-        def choose_name(i):
-            if i['uuid'] in links:
-                return links[i['uuid']]
-            else:
-                return i['uuid']
+        contents = self.api.groups().contents(uuid=self.uuid).execute()
 
         def same(a, i):
             if isinstance(a, CollectionDirectory):
                 return a.collection_locator == i['uuid']
-            elif isinstance(a, GroupDirectory):
+            elif isinstance(a, ProjectDirectory):
                 return a.uuid == i['uuid']
             elif isinstance(a, ObjectFile):
                 return a.uuid == i['uuid'] and not a.stale()
             return False
 
         self.merge(contents['items'],
-                   choose_name,
+                   lambda i: i['uuid'],
                    same,
                    self.createDirectory)
 

commit cd9c840e17c74989e6e60b5dd73d904d0165443f
Author: Peter Amstutz <peter.amstutz at curoverse.com>
Date:   Thu Aug 28 14:41:04 2014 -0400

    3644: Switched around command line parameters a bit.  Will default to --home
    now.  Renamed GroupsDirectory to HomeDirectory and GroupDirectory to
    ProjectDirectory.

diff --git a/services/fuse/arvados_fuse/__init__.py b/services/fuse/arvados_fuse/__init__.py
index cf14a3b..b69abda 100644
--- a/services/fuse/arvados_fuse/__init__.py
+++ b/services/fuse/arvados_fuse/__init__.py
@@ -288,11 +288,11 @@ class TagDirectory(Directory):
                    lambda i: CollectionDirectory(self.inode, self.inodes, i['head_uuid']))
 
 
-class GroupsDirectory(Directory):
-    '''A special directory that contains as subdirectories all groups visible to the user.'''
+class HomeDirectory(Directory):
+    '''A special directory that represents the "home" project.'''
 
     def __init__(self, parent_inode, inodes, api, poll_time=60):
-        super(GroupsDirectory, self).__init__(parent_inode)
+        super(HomeDirectory, self).__init__(parent_inode)
         self.inodes = inodes
         self.api = api
         try:
@@ -303,7 +303,7 @@ class GroupsDirectory(Directory):
 
     def invalidate(self):
         with llfuse.lock:
-            super(GroupsDirectory, self).invalidate()
+            super(HomeDirectory, self).invalidate()
             for a in self._entries:
                 self._entries[a].invalidate()
 
@@ -313,11 +313,11 @@ class GroupsDirectory(Directory):
         self.merge(groups['items'],
                    lambda i: i['uuid'],
                    lambda a, i: a.uuid == i['uuid'],
-                   lambda i: GroupDirectory(self.inode, self.inodes, self.api, i, poll=self._poll, poll_time=self._poll_time))
+                   lambda i: ProjectDirectory(self.inode, self.inodes, self.api, i, poll=self._poll, poll_time=self._poll_time))
 
 
-class GroupDirectory(Directory):
-    '''A special directory that contains the contents of a group.'''
+class ProjectDirectory(Directory):
+    '''A special directory that contains the contents of a project.'''
 
     def __init__(self, parent_inode, inodes, api, uuid, poll=False, poll_time=60):
         super(GroupDirectory, self).__init__(parent_inode)
diff --git a/services/fuse/bin/arv-mount b/services/fuse/bin/arv-mount
index 794a468..1b7f13b 100755
--- a/services/fuse/bin/arv-mount
+++ b/services/fuse/bin/arv-mount
@@ -15,11 +15,7 @@ logger = logging.getLogger('arvados.arv-mount')
 if __name__ == '__main__':
     # Handle command line parameters
     parser = argparse.ArgumentParser(
-        description='''Mount Keep data under the local filesystem.  By default, if neither
-        --collection or --tags is specified, this mounts as a virtual directory
-        under which all Keep collections are available as subdirectories named
-        with the Keep locator; however directories will not be visible to 'ls'
-        until a program tries to access them.''',
+        description='''Mount Keep data under the local filesystem.  Default mode is --home''',
         epilog="""
 Note: When using the --exec feature, you must either specify the
 mountpoint before --exec, or mark the end of your --exec arguments
@@ -28,10 +24,19 @@ with "--".
     parser.add_argument('mountpoint', type=str, help="""Mount point.""")
     parser.add_argument('--allow-other', action='store_true',
                         help="""Let other users read the mount""")
-    parser.add_argument('--collection', type=str, help="""Mount only the specified collection at the mount point.""")
-    parser.add_argument('--tags', action='store_true', help="""Mount as a virtual directory consisting of subdirectories representing tagged
-collections on the server.""")
-    parser.add_argument('--groups', action='store_true', help="""Mount as a virtual directory consisting of subdirectories representing groups on the server.""")
+
+    mount_mode = parser.add_mutually_exclusive_group()
+
+    mount_mode.add_argument('--home', action='store_true', help="""Mount the user's home project (default).""")
+    mount_mode.add_argument('--collection', type=str, help="""Mount only the specified collection at the mount point.""")
+    mount_mode.add_argument('--tags', action='store_true',
+                            help="""Mount as a virtual directory consisting of subdirectories representing
+tagged collections on the server.""")
+    mount_mode.add_argument('--project', type=str, help="""Mount a specific project by uuid.""")
+    mount_mode.add_argument('--by-hash', action='store_true',
+                            help="""Mount as a virtual directory consisting of subdirectories for each
+collection by portable data hash.""")
+
     parser.add_argument('--debug', action='store_true', help="""Debug mode""")
     parser.add_argument('--logfile', help="""Write debug logs and errors to the specified file (default stderr).""")
     parser.add_argument('--foreground', action='store_true', help="""Run in foreground (default is to daemonize unless --exec specified)""", default=False)
@@ -83,16 +88,19 @@ collections on the server.""")
         operations = Operations(os.getuid(), os.getgid())
         api = arvados.api('v1')
 
-        if args.groups:
-            e = operations.inodes.add_entry(GroupsDirectory(llfuse.ROOT_INODE, operations.inodes, api))
+        if args.by_hash:
+            # Set up the request handler with the 'magic directory' at the root
+            operations.inodes.add_entry(MagicDirectory(llfuse.ROOT_INODE, operations.inodes))
         elif args.tags:
             e = operations.inodes.add_entry(TagsDirectory(llfuse.ROOT_INODE, operations.inodes, api))
         elif args.collection != None:
             # Set up the request handler with the collection at the root
             e = operations.inodes.add_entry(CollectionDirectory(llfuse.ROOT_INODE, operations.inodes, args.collection))
+        elif args.project != None:
+            e = operations.inodes.add_entry(ProjectDirectory(llfuse.ROOT_INODE, operations.inodes, args.project))
         else:
-            # Set up the request handler with the 'magic directory' at the root
-            operations.inodes.add_entry(MagicDirectory(llfuse.ROOT_INODE, operations.inodes))
+            e = operations.inodes.add_entry(HomeDirectory(llfuse.ROOT_INODE, operations.inodes, api))
+
     except Exception:
         logger.exception("arv-mount: exception during API setup")
         exit(1)

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list