Merge branch '19704-aneta-r-sdk' refs #19704
[arvados.git] / services / fuse / arvados_fuse / command.py
index 994c998823905e4f2398b15eb911768de6e03aa5..e275825a6109126b15dca1941a55b306ba98b8b9 100644 (file)
@@ -16,6 +16,7 @@ import signal
 import subprocess
 import sys
 import time
+import resource
 
 import arvados.commands._util as arv_cmd
 from arvados_fuse import crunchstat
@@ -133,6 +134,15 @@ class Mount(object):
         if self.args.logfile:
             self.args.logfile = os.path.realpath(self.args.logfile)
 
+        try:
+            nofile_limit = resource.getrlimit(resource.RLIMIT_NOFILE)
+            if nofile_limit[0] < 10240:
+                resource.setrlimit(resource.RLIMIT_NOFILE, (min(10240, nofile_limit[1]), nofile_limit[1]))
+        except Exception as e:
+            self.logger.warning("arv-mount: unable to adjust file handle limit: %s", e)
+
+        self.logger.debug("arv-mount: file handle limit is %s", resource.getrlimit(resource.RLIMIT_NOFILE))
+
         try:
             self._setup_logging()
             self._setup_api()
@@ -227,7 +237,9 @@ class Mount(object):
                                                                disk_cache=self.args.disk_cache,
                                                                disk_cache_dir=self.args.disk_cache_dir),
                     'num_retries': self.args.retries,
-                })
+                },
+                version='v1',
+            )
         except KeyError as e:
             self.logger.error("Missing environment: %s", e)
             exit(1)