[arvados] updated: 2.1.0-3096-g31f36e0c8
git repository hosting
git at public.arvados.org
Fri Dec 2 16:15:07 UTC 2022
Summary of changes:
sdk/python/arvados/keep.py | 27 +++++++++++++--------------
1 file changed, 13 insertions(+), 14 deletions(-)
via 31f36e0c8aca5afe43cbe6273ecb8509fa41600b (commit)
from 5a46895af3657b549264a68bd2450baf8dbf7215 (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 31f36e0c8aca5afe43cbe6273ecb8509fa41600b
Author: Peter Amstutz <peter.amstutz at curii.com>
Date: Fri Dec 2 11:14:51 2022 -0500
18842: Clean up keep cache set logic a little more
Arvados-DCO-1.1-Signed-off-by: Peter Amstutz <peter.amstutz at curii.com>
diff --git a/sdk/python/arvados/keep.py b/sdk/python/arvados/keep.py
index 44f10e4fb..8dbad2abb 100644
--- a/sdk/python/arvados/keep.py
+++ b/sdk/python/arvados/keep.py
@@ -316,12 +316,10 @@ class KeepBlockCache(object):
return n, True
def set(self, slot, blob):
- tryagain = False
-
try:
slot.set(blob)
+ return
except OSError as e:
- tryagain = True
if e.errno == errno.ENOMEM:
# Reduce max slots to current - 4, cap cache and retry
with self._cache_lock:
@@ -334,20 +332,21 @@ class KeepBlockCache(object):
elif e.errno == errno.ENODEV:
_logger.error("Unable to use disk cache: The underlying filesystem does not support memory mapping.")
except Exception as e:
- tryagain = True
-
- # Check if we should evict things from the cache. Either
- # because we added a new thing or we adjusted the limits down,
- # so we might need to push something out.
- self.cap_cache()
-
- if not tryagain:
- # Done
- return
+ pass
+ finally:
+ # Check if we should evict things from the cache. Either
+ # because we added a new thing or there was an error and
+ # we possibly adjusted the limits down, so we might need
+ # to push something out.
+ self.cap_cache()
try:
- # There was an error, we ran cap_cache so try one more time.
+ # Only gets here if there was an error the first time. The
+ # exception handler adjusts limits downward in some cases
+ # to free up resources, which would make the operation
+ # succeed.
slot.set(blob)
+ self.cap_cache()
except Exception as e:
# It failed again. Give up.
raise arvados.errors.KeepCacheError("Unable to save block %s to disk cache: %s" % (slot.locator, e))
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list