[ARVADOS] updated: 2.1.0-2177-gd3051d45d
Git user
git at public.arvados.org
Wed Mar 30 03:12:56 UTC 2022
Summary of changes:
sdk/python/arvados/arvfile.py | 3 +--
sdk/python/arvados/keep.py | 23 +++++++++++++----------
sdk/python/tests/test_arvfile.py | 2 +-
sdk/python/tests/test_collections.py | 2 +-
4 files changed, 16 insertions(+), 14 deletions(-)
via d3051d45df5ee760a05a84bf4d385799c4326477 (commit)
from aac0a284e71ab62b2537a6fdeab6d736deb9a1a9 (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 d3051d45df5ee760a05a84bf4d385799c4326477
Author: Peter Amstutz <peter.amstutz at curii.com>
Date: Tue Mar 29 23:09:46 2022 -0400
18941: Rename cache_slot_get option to 'prefetch' for clarity
Arvados-DCO-1.1-Signed-off-by: Peter Amstutz <peter.amstutz at curii.com>
diff --git a/sdk/python/arvados/arvfile.py b/sdk/python/arvados/arvfile.py
index a13575b71..2ce0e46b3 100644
--- a/sdk/python/arvados/arvfile.py
+++ b/sdk/python/arvados/arvfile.py
@@ -593,7 +593,7 @@ class _BlockManager(object):
b = self._prefetch_queue.get()
if b is None:
return
- self._keep.get(b, cache_slot_get=False)
+ self._keep.get(b, prefetch=True)
except Exception:
_logger.exception("Exception doing block prefetch")
@@ -846,7 +846,6 @@ class _BlockManager(object):
return
self.start_get_threads()
- # _logger.debug("pushing %s to prefetch", locator)
self._prefetch_queue.put(locator)
diff --git a/sdk/python/arvados/keep.py b/sdk/python/arvados/keep.py
index 53776017d..7c05cc0a6 100644
--- a/sdk/python/arvados/keep.py
+++ b/sdk/python/arvados/keep.py
@@ -1058,7 +1058,7 @@ class KeepClient(object):
def get(self, loc_s, **kwargs):
return self._get_or_head(loc_s, method="GET", **kwargs)
- def _get_or_head(self, loc_s, method="GET", num_retries=None, request_id=None, headers=None, cache_slot_get=True):
+ def _get_or_head(self, loc_s, method="GET", num_retries=None, request_id=None, headers=None, prefetch=False):
"""Get data from Keep.
This method fetches one or more blocks of data from Keep. It
@@ -1097,16 +1097,19 @@ class KeepClient(object):
if method == "GET":
slot, first = self.block_cache.reserve_cache(locator.md5sum)
if not first:
- self.hits_counter.add(1)
- if cache_slot_get:
- blob = slot.get()
- if blob is None:
- raise arvados.errors.KeepReadError(
- "failed to read {}".format(loc_s))
- return blob
- else:
- slot = None # prevent finally from calling slot.set()
+ if prefetch:
+ # this is request for a prefetch, if it is
+ # already in flight, return immediately.
+ # clear 'slot' to prevent finally block from
+ # calling slot.set()
+ slot = None
return None
+ self.hits_counter.add(1)
+ blob = slot.get()
+ if blob is None:
+ raise arvados.errors.KeepReadError(
+ "failed to read {}".format(loc_s))
+ return blob
self.misses_counter.add(1)
diff --git a/sdk/python/tests/test_arvfile.py b/sdk/python/tests/test_arvfile.py
index fce48479a..b45a592ec 100644
--- a/sdk/python/tests/test_arvfile.py
+++ b/sdk/python/tests/test_arvfile.py
@@ -27,7 +27,7 @@ class ArvadosFileWriterTestCase(unittest.TestCase):
def __init__(self, blocks):
self.blocks = blocks
self.requests = []
- def get(self, locator, num_retries=0, cache_slot_get=None):
+ def get(self, locator, num_retries=0, prefetch=False):
self.requests.append(locator)
return self.blocks.get(locator)
def get_from_cache(self, locator):
diff --git a/sdk/python/tests/test_collections.py b/sdk/python/tests/test_collections.py
index e2d644b86..5cf4993b2 100644
--- a/sdk/python/tests/test_collections.py
+++ b/sdk/python/tests/test_collections.py
@@ -320,7 +320,7 @@ class ArvadosCollectionsTest(run_test_server.TestCaseWithServers,
def __init__(self, content, num_retries=0):
self.content = content
- def get(self, locator, num_retries=0, cache_slot_get=None):
+ def get(self, locator, num_retries=0, prefetch=False):
return self.content[locator]
def test_stream_reader(self):
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list