From: Peter Amstutz Date: Mon, 17 Feb 2014 18:41:51 +0000 (+0000) Subject: implemented arv-ls to replace whls X-Git-Tag: 1.1.0~2736^2~28 X-Git-Url: https://git.arvados.org/arvados.git/commitdiff_plain/89a9429f8fe9248320fad181afe972e144d10669 implemented arv-ls to replace whls --- diff --git a/sdk/python/arvados/keep.py b/sdk/python/arvados/keep.py index 38dddbe22b..5f9a6d916b 100644 --- a/sdk/python/arvados/keep.py +++ b/sdk/python/arvados/keep.py @@ -250,18 +250,19 @@ class KeepClient(object): """Put a block into the cache.""" if self.check_cache(locator) != None: return - self.cache_lock.acquire() + self._cache_lock.acquire() try: # first check cache size and delete stuff from the end if necessary sm = sum([len(a[1]) for a in self._cache]) + len(data) - while sum > self._cache_max: + while sm > self._cache_max: + print sm, self._cache_max del self._cache[-1] sm = sum([len(a[1]) for a in self._cache]) + len(data) # now add the new block at the front of the list self._cache.insert(0, [locator, data]) finally: - self.cache_lock.release() + self._cache_lock.release() def check_cache(self, locator): """Get a block from the cache. Also moves the block to the front of the list.""" diff --git a/sdk/python/bin/arv-ls b/sdk/python/bin/arv-ls index f30145af54..c96f4cfa55 100755 --- a/sdk/python/bin/arv-ls +++ b/sdk/python/bin/arv-ls @@ -24,5 +24,5 @@ import arvados cr = arvados.CollectionReader(arvados.Keep.get(args.locator)) -for f in rc.all_files(): +for f in cr.all_files(): print(f.stream_name() + "/" + f.name())