[ARVADOS] updated: a92397d6b80e25974da5d56ef59ab27eb9b45384

git at public.curoverse.com git at public.curoverse.com
Tue Sep 2 13:01:15 EDT 2014


Summary of changes:
 services/fuse/arvados_fuse/__init__.py | 31 ++++++++++++++++++++++++++++++-
 1 file changed, 30 insertions(+), 1 deletion(-)

       via  a92397d6b80e25974da5d56ef59ab27eb9b45384 (commit)
      from  72de9238eda9b294c281d1ee747b00f3eca5c1df (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit a92397d6b80e25974da5d56ef59ab27eb9b45384
Author: Peter Amstutz <peter.amstutz at curoverse.com>
Date:   Tue Sep 2 13:01:12 2014 -0400

    3644: build_project_trees method ported from workbench, needs testing

diff --git a/services/fuse/arvados_fuse/__init__.py b/services/fuse/arvados_fuse/__init__.py
index 4b8f5ba..e7b05ef 100644
--- a/services/fuse/arvados_fuse/__init__.py
+++ b/services/fuse/arvados_fuse/__init__.py
@@ -402,11 +402,40 @@ class ProjectDirectory(RecursiveInvalidateDirectory):
         return convertTime(self.project_object["modified_at"]) if self.project_object is not None else 0
 
 
+
 class HomeDirectory(ProjectDirectory):
     '''A special directory that represents the "home" project.'''
 
     def __init__(self, parent_inode, inodes, api, poll=False, poll_time=60):
-        super(HomeDirectory, self).__init__(parent_inode, inodes, api, api.users().current().execute())
+        self.current_user = api.users().current().execute()
+        super(HomeDirectory, self).__init__(parent_inode, inodes, api, self.current_user)
+
+    def build_project_trees():
+        all_projects = self.api.groups().list(filters=[['group_class','=','project']], order=['name']).execute()['items']
+        parent_of = {self.current_user['uuid']: 'me'}
+        for ob in all_projects:
+            parent_of[ob['uuid']] = ob['owner_uuid']
+        children_of = {False: [], 'me': [self.current_user]}
+
+        for ob in all_projects:
+            if ob['owner_uuid'] != self.current_user['uuid'] and ob['owner_uuid'] not in parent_of:
+                parent_of[ob['uuid']] = False
+            if parent_of[ob['uuid']] not in children_of:
+                children_of[parent_of[ob['uuid']]] = []
+            children_of[parent_of[ob['uuid']]] += ob
+
+        def buildtree(children_of, root_uuid):
+            tree = {}
+            for ob in children_of[root_uuid]:
+                tree[ob] = buildtree(children_of, ob['uuid'])
+            return tree
+
+        my_project_tree = buildtree(children_of, 'me')
+        shared_project_tree = buildtree(children_of, False)
+
+        import pprint
+        pprint.pprint(my_project_tree)
+        pprint.pprint(shared_project_tree)
 
     #def contents(self):
     #    return self.api.groups().contents(uuid=self.uuid).execute()['items']

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list