import time
import arvados.commands._util as arv_cmd
-from arvados_fuse import crunchstat
from arvados_fuse import *
from arvados_fuse._version import __version__
path = os.path.realpath(path)
was_mounted = False
- t0 = time.time()
- delay = 0
- while True:
- if timeout and t0 + timeout < time.time():
- raise Exception("timed out")
+ attempted = False
+ if timeout is None:
+ deadline = None
+ else:
+ deadline = time.time() + timeout
+ while True:
mounted = False
for m in mountinfo():
if m.is_fuse:
if not mounted:
return was_mounted
+ if attempted:
+ delay = 1
+ if deadline:
+ delay = min(delay, deadline - time.time())
+ if delay <= 0:
+ raise Exception("timed out")
+ time.sleep(delay)
+
try:
with open('/sys/fs/fuse/connections/{}/abort'.format(m.minor),
'w') as f:
except OSError as e:
if e.errno != errno.ENOENT:
raise
+
+ attempted = True
try:
subprocess.check_call(["fusermount", "-u", "-z", path])
except subprocess.CalledProcessError:
pass
-
- time.sleep(delay)
- if delay == 0:
- delay = 1