Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
fc104d7c
提交
fc104d7c
authored
2月 24, 2015
作者:
Frederic
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Make sure to not delete empty folder when we do not have the lock
上级
1d9b897b
显示空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
16 行增加
和
2 行删除
+16
-2
cmodule.py
theano/gof/cmodule.py
+16
-2
没有找到文件。
theano/gof/cmodule.py
浏览文件 @
fc104d7c
...
@@ -663,10 +663,16 @@ class ModuleCache(object):
...
@@ -663,10 +663,16 @@ class ModuleCache(object):
too_old_to_use
=
[]
too_old_to_use
=
[]
to_delete
=
[]
to_delete
=
[]
to_delete_empty
=
[]
def
rmtree
(
*
args
,
**
kwargs
):
def
rmtree
(
*
args
,
**
kwargs
):
if
cleanup
:
if
cleanup
:
to_delete
.
append
((
args
,
kwargs
))
to_delete
.
append
((
args
,
kwargs
))
def
rmtree_empty
(
*
args
,
**
kwargs
):
if
cleanup
:
to_delete_empty
.
append
((
args
,
kwargs
))
# add entries that are not in the entry_from_key dictionary
# add entries that are not in the entry_from_key dictionary
time_now
=
time
.
time
()
time_now
=
time
.
time
()
# Go through directories in alphabetical order to ensure consistent
# Go through directories in alphabetical order to ensure consistent
...
@@ -684,7 +690,11 @@ class ModuleCache(object):
...
@@ -684,7 +690,11 @@ class ModuleCache(object):
if
not
os
.
path
.
isdir
(
root
):
if
not
os
.
path
.
isdir
(
root
):
continue
continue
files
=
os
.
listdir
(
root
)
files
=
os
.
listdir
(
root
)
if
not
files
or
'delete.me'
in
files
:
if
not
files
:
rmtree_empty
(
root
,
ignore_nocleanup
=
True
,
msg
=
"empty dir"
)
continue
if
'delete.me'
in
files
:
rmtree
(
root
,
ignore_nocleanup
=
True
,
rmtree
(
root
,
ignore_nocleanup
=
True
,
msg
=
"delete.me found in dir"
)
msg
=
"delete.me found in dir"
)
continue
continue
...
@@ -900,10 +910,14 @@ class ModuleCache(object):
...
@@ -900,10 +910,14 @@ class ModuleCache(object):
pkl_file_to_remove
)
pkl_file_to_remove
)
self
.
loaded_key_pkl
.
remove
(
pkl_file_to_remove
)
self
.
loaded_key_pkl
.
remove
(
pkl_file_to_remove
)
if
to_delete
:
if
to_delete
or
to_delete_empty
:
with
compilelock
.
lock_ctx
():
with
compilelock
.
lock_ctx
():
for
a
,
kw
in
to_delete
:
for
a
,
kw
in
to_delete
:
_rmtree
(
*
a
,
**
kw
)
_rmtree
(
*
a
,
**
kw
)
for
a
,
kw
in
to_delete_empty
:
files
=
os
.
listdir
(
a
[
0
])
if
not
files
:
_rmtree
(
*
a
,
**
kw
)
_logger
.
debug
(
'Time needed to refresh cache:
%
s'
,
_logger
.
debug
(
'Time needed to refresh cache:
%
s'
,
(
time
.
time
()
-
start_time
))
(
time
.
time
()
-
start_time
))
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论