21639: Code cleanup
authorPeter Amstutz <peter.amstutz@curii.com>
Wed, 3 Apr 2024 21:17:50 +0000 (17:17 -0400)
committerPeter Amstutz <peter.amstutz@curii.com>
Wed, 3 Apr 2024 21:17:50 +0000 (17:17 -0400)
Arvados-DCO-1.1-Signed-off-by: Peter Amstutz <peter.amstutz@curii.com>

sdk/python/arvados/diskcache.py
sdk/python/arvados/keep.py

index 149f5027d4169369cbe951af51c9c8e9feca6785..22bf73894b8fd8d9d1a1270de1973481a937dc51 100644 (file)
@@ -91,7 +91,6 @@ class DiskCacheSlot(object):
                     os.remove(tmpfile)
                 except:
                     pass
-        return False
 
     def size(self):
         if self.content is None:
index 94f8abc73f2968d8e236d17bde24712789a30dc4..a8246210793e6964ca89ea6f5f0f0d7a5ac4d497 100644 (file)
@@ -277,7 +277,7 @@ class KeepBlockCache(object):
             return
 
         _evict_candidates = collections.deque(self._cache.values())
-        while len(_evict_candidates) > 0 and (self.cache_total > cache_max or len(self._cache) > max_slots):
+        while _evict_candidates and (self.cache_total > cache_max or len(self._cache) > max_slots):
             slot = _evict_candidates.popleft()
             if not slot.ready.is_set():
                 continue
@@ -354,7 +354,7 @@ class KeepBlockCache(object):
             elif e.errno == errno.ENOSPC:
                 # Reduce disk max space to current - 256 MiB, cap cache and retry
                 with self._cache_lock:
-                    sm = sum([st.size() for st in self._cache.values()])
+                    sm = sum(st.size() for st in self._cache.values())
                     self.cache_max = max((256 * 1024 * 1024), sm - (256 * 1024 * 1024))
             elif e.errno == errno.ENODEV:
                 _logger.error("Unable to use disk cache: The underlying filesystem does not support memory mapping.")