Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
925dd14b
提交
925dd14b
authored
1月 12, 2015
作者:
abergeron
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #2394 from nouiz/lock
Do not make Theano cache code delete the lock directory. This fix proble...
上级
ffa20c97
7de28c60
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
12 行增加
和
3 行删除
+12
-3
cmodule.py
theano/gof/cmodule.py
+4
-0
compilelock.py
theano/gof/compilelock.py
+8
-3
没有找到文件。
theano/gof/cmodule.py
浏览文件 @
925dd14b
...
...
@@ -673,6 +673,10 @@ class ModuleCache(object):
continue
if
not
os
.
path
.
isdir
(
root
):
continue
# Some sub directory we do not want the cache to mess
# with. This can cause problems with multiple process.
if
os
.
path
.
split
(
root
)[
1
]
in
[
"lock_dir"
]:
continue
files
=
os
.
listdir
(
root
)
if
not
files
or
'delete.me'
in
files
:
rmtree
(
root
,
ignore_nocleanup
=
True
,
...
...
theano/gof/compilelock.py
浏览文件 @
925dd14b
...
...
@@ -24,6 +24,7 @@ AddConfigVar('compile.wait',
IntParam
(
5
,
lambda
i
:
i
>
0
,
allow_override
=
False
),
in_c_key
=
False
)
def
_timeout_default
():
return
config
.
compile
.
wait
*
24
...
...
@@ -37,6 +38,8 @@ period for running processes.""",
allow_override
=
False
),
in_c_key
=
False
)
hostname
=
socket
.
gethostname
()
def
force_unlock
():
"""
...
...
@@ -129,6 +132,7 @@ def set_lock_status(use_lock):
# This is because None is a valid input for timeout
notset
=
object
()
def
lock
(
tmp_dir
,
timeout
=
notset
,
min_wait
=
None
,
max_wait
=
None
,
verbosity
=
1
):
"""
Obtain lock access by creating a given temporary directory (whose base will
...
...
@@ -212,13 +216,14 @@ def lock(tmp_dir, timeout=notset, min_wait=None, max_wait=None, verbosity=1):
other_host
=
read_owner
.
split
(
'_'
)[
2
]
except
IndexError
:
other_host
=
()
# make sure it isn't equal to any host
if
other_host
==
socket
.
gethostname
()
:
if
other_host
==
hostname
:
try
:
# Just check if the other process still exist.
os
.
kill
(
int
(
read_owner
.
split
(
'_'
)[
0
]),
0
)
except
OSError
:
other_dead
=
True
except
AttributeError
:
pass
#
os.kill does not exist on windows
pass
#
os.kill does not exist on windows
except
Exception
:
read_owner
=
'failure'
if
other_dead
:
...
...
@@ -305,7 +310,7 @@ def refresh_lock(lock_file):
unique_id
=
'
%
s_
%
s_
%
s'
%
(
os
.
getpid
(),
''
.
join
([
str
(
random
.
randint
(
0
,
9
))
for
i
in
range
(
10
)]),
socket
.
gethostname
()
)
hostname
)
lock_write
=
open
(
lock_file
,
'w'
)
lock_write
.
write
(
unique_id
+
'
\n
'
)
lock_write
.
close
()
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论