Merge branch '21611-log-chunk-delay'
[arvados.git] / services / fuse / arvados_fuse / __init__.py
index 2dfba464738868b5ced8e468e26e9eb1d5db9e34..c29c2430dccec4570532e22950cdb42205b5d192 100644 (file)
@@ -54,11 +54,6 @@ inode assigned to it and appears in the Inodes._entries dictionary.
 
 """
 
-from __future__ import absolute_import
-from __future__ import division
-from builtins import next
-from builtins import str
-from builtins import object
 import os
 import llfuse
 import errno
@@ -77,7 +72,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 +148,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 +185,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 +407,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()
@@ -626,13 +623,6 @@ class Operations(llfuse.Operations):
         self.write_ops_counter = arvados.keep.Counter()
 
         self.events = None
-l
-        # 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