提交 d1222d9c authored 作者: Arnaud Bergeron's avatar Arnaud Bergeron

Cleanup refresh to make the cleanup optional and avoid taking the lock

if we don't delete anything.
上级 57bea857
差异被折叠。
...@@ -7,6 +7,7 @@ import random ...@@ -7,6 +7,7 @@ import random
import socket # only used for gethostname() import socket # only used for gethostname()
import time import time
import logging import logging
import contextlib
from theano import config from theano import config
from theano.configparser import AddConfigVar, IntParam from theano.configparser import AddConfigVar, IntParam
...@@ -44,6 +45,14 @@ def force_unlock(): ...@@ -44,6 +45,14 @@ def force_unlock():
release_lock() release_lock()
@contextmanager
def lock_ctx(lock_dir=None, keep_lock=False, **kw):
get_lock(lock_dir=lock_dir, **kw)
yield
if not keep_lock:
release_lock()
def get_lock(lock_dir=None, **kw): def get_lock(lock_dir=None, **kw):
""" """
Obtain lock on compilation directory. Obtain lock on compilation directory.
......
File mode changed from 100755 to 100644
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论