[arvados] updated: 2.7.0-6220-g9c1b519f2a

git repository hosting git at public.arvados.org
Tue Apr 2 14:53:13 UTC 2024


Summary of changes:
 services/fuse/arvados_fuse/__init__.py | 15 +++++----------
 services/fuse/arvados_fuse/fusedir.py  |  9 +++++----
 2 files changed, 10 insertions(+), 14 deletions(-)

       via  9c1b519f2ad5382d9472d755c05b109dab92d610 (commit)
      from  58fe2158d605b653cd2de61da22bed092dce58b1 (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 9c1b519f2ad5382d9472d755c05b109dab92d610
Author: Peter Amstutz <peter.amstutz at curii.com>
Date:   Tue Apr 2 10:52:09 2024 -0400

    21541: Code cleanups
    
    * Remove the gc threshold change
    * Add/improve comments
    * Use "truthy" tests instead of len(foo) > 0
    
    Arvados-DCO-1.1-Signed-off-by: Peter Amstutz <peter.amstutz at curii.com>

diff --git a/services/fuse/arvados_fuse/__init__.py b/services/fuse/arvados_fuse/__init__.py
index aeb0ce4ba7..d827aefab7 100644
--- a/services/fuse/arvados_fuse/__init__.py
+++ b/services/fuse/arvados_fuse/__init__.py
@@ -77,7 +77,6 @@ from prometheus_client import Summary
 import queue
 from dataclasses import dataclass
 import typing
-import gc
 
 from .fusedir import Directory, CollectionDirectory, TmpCollectionDirectory, MagicDirectory, TagsDirectory, ProjectDirectory, SharedDirectory, CollectionDirectoryBase
 from .fusefile import File, StringFile, FuseArvadosFile
@@ -154,6 +153,9 @@ class InodeCache(object):
     """
 
     def __init__(self, cap, min_entries=4):
+        # Standard dictionaries are ordered, but OrderedDict is still better here, see
+        # https://docs.python.org/3.11/library/collections.html#ordereddict-objects
+        # specifically we use move_to_end() which standard dicts don't have.
         self._cache_entries = collections.OrderedDict()
         self.cap = cap
         self._total = 0
@@ -188,7 +190,7 @@ class InodeCache(object):
         # "values"
         values = collections.deque(self._cache_entries.values())
 
-        while len(values) > 0:
+        while values:
             if self._total < self.cap or len(self._cache_entries) < self.min_entries:
                 break
             yield values.popleft()
@@ -410,7 +412,7 @@ class Inodes(object):
                 qentry = None
 
             with llfuse.lock:
-                while len(locked_ops) > 0:
+                while locked_ops:
                     if locked_ops.popleft().inode_op(self, None):
                         self._inode_remove_queue.task_done()
                 self.cap_cache_event.clear()
@@ -627,13 +629,6 @@ class Operations(llfuse.Operations):
 
         self.events = None
 
-        # We rely on the cyclic garbage collector to deallocate
-        # Collection objects from the Python SDK.  A lower GC
-        # threshold encourages Python to be more aggressive in
-        # reclaiming these and seems to slow down the growth in memory
-        # usage over time.
-        gc.set_threshold(200)
-
     def init(self):
         # Allow threads that are waiting for the driver to be finished
         # initializing to continue
diff --git a/services/fuse/arvados_fuse/fusedir.py b/services/fuse/arvados_fuse/fusedir.py
index dbb7bb83f7..9c78805107 100644
--- a/services/fuse/arvados_fuse/fusedir.py
+++ b/services/fuse/arvados_fuse/fusedir.py
@@ -218,7 +218,7 @@ class Directory(FreshBase):
 
     def clear(self):
         """Delete all entries"""
-        if len(self._entries) == 0:
+        if not self._entries:
             return
         oldentries = self._entries
         self._entries = {}
@@ -645,9 +645,10 @@ class CollectionDirectory(CollectionDirectoryBase):
 
     def objsize(self):
         # This is a rough guess of the amount of overhead involved for
-        # a collection; the calculation is each file averages 128
-        # bytes in the manifest, but consume 1024 bytes when blown up
-        # into Python data structures.
+        # a collection; the assumptions are that that each file
+        # averages 128 bytes in the manifest, but consume 1024 bytes
+        # of Python data structures, so 1024/128=8 means we estimate
+        # the RAM footprint at 8 times the size of bare manifest text.
         return self._manifest_size * 8
 
     def finalize(self):

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list