Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
81f3bd72
提交
81f3bd72
authored
6月 13, 2011
作者:
Olivier Delalleau
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Modules associated to broken keys are now properly deleted in clear_old
上级
5097880c
显示空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
15 行增加
和
15 行删除
+15
-15
cmodule.py
theano/gof/cmodule.py
+15
-15
没有找到文件。
theano/gof/cmodule.py
浏览文件 @
81f3bd72
...
@@ -838,30 +838,30 @@ class ModuleCache(object):
...
@@ -838,30 +838,30 @@ class ModuleCache(object):
# update the age of modules that have been accessed by other processes
# update the age of modules that have been accessed by other processes
# and get all module that are too old to use.(not loaded in self.entry_from_key)
# and get all module that are too old to use.(not loaded in self.entry_from_key)
too_old_to_use
=
self
.
refresh
()
too_old_to_use
=
self
.
refresh
()
too_old_to_use
=
[(
None
,
entry
)
for
entry
in
too_old_to_use
]
time_now
=
time
.
time
()
time_now
=
time
.
time
()
#
the .iteritems() is important here:
#
Build list of module files and associated keys.
# we need to get a copy of the whole list of keys and entries
entry_to_key_data
=
dict
((
entry
,
None
)
for
entry
in
too_old_to_use
)
items_copy
=
list
(
self
.
entry_from_key
.
iteritems
())
for
key_data
in
self
.
module_hash_to_key_data
.
itervalues
():
all_items
=
items_copy
+
too_old_to_use
# TODO We should probably save the entry path directly in
# Since multiple keys may share the same entry, we turn this list
# the KeyData objects to avoid additional disk access.
# of pairs into a dictionary that maps an entry to the list of keys
entry
=
module_name_from_dir
(
os
.
path
.
dirname
(
key_data
.
key_pkl
))
# that use it.
# Since we loaded this file, it should not be in
entry_to_keys
=
dict
((
entry
,
[])
# too_old_to_use.
for
key
,
entry
in
all_items
)
assert
entry
not
in
entry_to_key_data
for
key
,
entry
in
all_items
:
entry_to_key_data
[
entry
]
=
key_data
entry_to_keys
[
entry
]
.
append
(
key
)
for
entry
,
key
s
in
entry_to_keys
.
iteritems
():
for
entry
,
key
_data
in
entry_to_key_data
.
iteritems
():
age
=
time_now
-
last_access_time
(
entry
)
age
=
time_now
-
last_access_time
(
entry
)
if
age
>
age_thresh_del
:
if
age
>
age_thresh_del
:
# TODO: we are assuming that modules that haven't been accessed in over
# TODO: we are assuming that modules that haven't been accessed in over
# age_thresh_del are not currently in use by other processes, but that could be
# age_thresh_del are not currently in use by other processes, but that could be
# false for long-running jobs...
# false for long-running jobs...
assert
entry
not
in
self
.
module_from_name
assert
entry
not
in
self
.
module_from_name
for
key
in
keys
:
if
key_data
is
not
None
:
if
key
is
not
None
:
for
keys
in
key_data
.
keys
:
del
self
.
entry_from_key
[
key
]
del
self
.
entry_from_key
[
key
]
del
self
.
module_hash_to_key_data
[
key_data
.
module_hash
]
parent
=
os
.
path
.
dirname
(
entry
)
parent
=
os
.
path
.
dirname
(
entry
)
assert
parent
.
startswith
(
os
.
path
.
join
(
self
.
dirname
,
'tmp'
))
assert
parent
.
startswith
(
os
.
path
.
join
(
self
.
dirname
,
'tmp'
))
_rmtree
(
parent
,
msg
=
'old cache directory'
,
level
=
'info'
)
_rmtree
(
parent
,
msg
=
'old cache directory'
,
level
=
'info'
)
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论