[ARVADOS] updated: 62f1bc50cd623e1fb2e62b68db46aa40ede5520d
Git user
git at public.curoverse.com
Fri Jun 30 16:27:59 EDT 2017
Summary of changes:
sdk/python/arvados/util.py | 11 +++++++----
services/fuse/arvados_fuse/fusedir.py | 4 ++--
2 files changed, 9 insertions(+), 6 deletions(-)
via 62f1bc50cd623e1fb2e62b68db46aa40ede5520d (commit)
from 024a666e751e4463f5c9cabed771a3bd8833c589 (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 62f1bc50cd623e1fb2e62b68db46aa40ede5520d
Author: Peter Amstutz <peter.amstutz at curoverse.com>
Date: Fri Jun 30 16:27:43 2017 -0400
11158: Improve arvados.util.list_all() implementation to avoid relying on
items_available.
Arvados-DCO-1.1-Signed-off-by: Peter Amstutz <peter.amstutz at curoverse.com>
diff --git a/sdk/python/arvados/util.py b/sdk/python/arvados/util.py
index 97e1d26..779b416 100644
--- a/sdk/python/arvados/util.py
+++ b/sdk/python/arvados/util.py
@@ -369,13 +369,16 @@ def is_hex(s, *length_args):
def list_all(fn, num_retries=0, **kwargs):
# Default limit to (effectively) api server's MAX_LIMIT
kwargs.setdefault('limit', sys.maxsize)
+ kwargs.setdefault('order', 'created_at asc')
+ kwargs.setdefault('count', 'none')
items = []
offset = 0
- items_available = sys.maxsize
- while len(items) < items_available:
+ while True:
c = fn(offset=offset, **kwargs).execute(num_retries=num_retries)
- items += c['items']
- items_available = c['items_available']
+ items.extend(c['items'])
+ if len(c['items']) < c['limit']:
+ # Didn't return a full page, so we're done.
+ break
offset = c['offset'] + len(c['items'])
return items
diff --git a/services/fuse/arvados_fuse/fusedir.py b/services/fuse/arvados_fuse/fusedir.py
index 89da451..a7be437 100644
--- a/services/fuse/arvados_fuse/fusedir.py
+++ b/services/fuse/arvados_fuse/fusedir.py
@@ -819,11 +819,11 @@ class ProjectDirectory(Directory):
self.num_retries,
filters=[["owner_uuid", "=", self.project_uuid],
["group_class", "=", "project"]],
- limit=1000, order="modified_at desc")
+ limit=1000)
contents.extend(arvados.util.list_all(self.api.collections().list,
self.num_retries,
filters=[["owner_uuid", "=", self.project_uuid]],
- limit=1000, order="modified_at desc"))
+ limit=1000))
# end with llfuse.lock_released, re-acquire lock
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list