File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change 8
8
from contextlib import contextmanager
9
9
from pathlib import Path
10
10
11
- import filelock
12
-
13
11
from pytensor .configdefaults import config
14
12
15
13
@@ -35,8 +33,9 @@ def force_unlock(lock_dir: os.PathLike):
35
33
lock_dir : os.PathLike
36
34
Path to a directory that was locked with `lock_ctx`.
37
35
"""
36
+ from filelock import FileLock
38
37
39
- fl = filelock . FileLock (Path (lock_dir ) / ".lock" )
38
+ fl = FileLock (Path (lock_dir ) / ".lock" )
40
39
fl .release (force = True )
41
40
42
41
dir_key = f"{ lock_dir } -{ os .getpid ()} "
@@ -62,6 +61,8 @@ def lock_ctx(
62
61
Timeout in seconds for waiting in lock acquisition.
63
62
Defaults to `pytensor.config.compile__timeout`.
64
63
"""
64
+ from filelock import FileLock
65
+
65
66
if lock_dir is None :
66
67
lock_dir = config .compiledir
67
68
@@ -73,7 +74,7 @@ def lock_ctx(
73
74
74
75
if dir_key not in local_mem ._locks :
75
76
local_mem ._locks [dir_key ] = True
76
- fl = filelock . FileLock (Path (lock_dir ) / ".lock" )
77
+ fl = FileLock (Path (lock_dir ) / ".lock" )
77
78
fl .acquire (timeout = timeout )
78
79
try :
79
80
yield
You can’t perform that action at this time.
0 commit comments