[arvados] updated: 2.1.0-3095-g5a46895af
git repository hosting
git at public.arvados.org
Fri Dec 2 16:04:51 UTC 2022
Summary of changes:
sdk/python/arvados/diskcache.py | 2 ++
sdk/python/arvados/keep.py | 16 +++++++++++-----
2 files changed, 13 insertions(+), 5 deletions(-)
via 5a46895af3657b549264a68bd2450baf8dbf7215 (commit)
from 1913b4edcb176909e8cf7ef3272c41bf8f2c7e1a (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 5a46895af3657b549264a68bd2450baf8dbf7215
Author: Peter Amstutz <peter.amstutz at curii.com>
Date: Fri Dec 2 11:04:27 2022 -0500
18842: Clean up keep cache set() a little bit
Arvados-DCO-1.1-Signed-off-by: Peter Amstutz <peter.amstutz at curii.com>
diff --git a/sdk/python/arvados/diskcache.py b/sdk/python/arvados/diskcache.py
index 74b2a77b2..f3984bbca 100644
--- a/sdk/python/arvados/diskcache.py
+++ b/sdk/python/arvados/diskcache.py
@@ -66,6 +66,8 @@ class DiskCacheSlot(object):
tmpfile = None
self.content = mmap.mmap(self.filehandle.fileno(), 0, access=mmap.ACCESS_READ)
+ # only set the event when mmap is successful
+ self.ready.set()
finally:
if tmpfile is not None:
# If the tempfile hasn't been renamed on disk yet, try to delete it.
diff --git a/sdk/python/arvados/keep.py b/sdk/python/arvados/keep.py
index ce4c6f81f..44f10e4fb 100644
--- a/sdk/python/arvados/keep.py
+++ b/sdk/python/arvados/keep.py
@@ -336,11 +336,18 @@ class KeepBlockCache(object):
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
+
try:
- if tryagain:
- # There was an error. Evict some slots and try again.
- self.cap_cache()
- slot.set(blob)
+ # There was an error, we ran cap_cache so try one more time.
+ slot.set(blob)
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))
@@ -349,7 +356,6 @@ class KeepBlockCache(object):
# slot one way or another.
slot.ready.set()
- self.cap_cache()
class Counter(object):
def __init__(self, v=0):
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list