Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
353cd469
提交
353cd469
authored
3月 12, 2010
作者:
Frederic Bastien
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
now cmodule don't use file that are 3 weeks old and delete them after 31 day.
This is to remove most of error about deleted file in the buildbot. It don't solve the problem if a process run for more then 1 week.
上级
7014437a
显示空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
12 行增加
和
8 行删除
+12
-8
cmodule.py
theano/gof/cmodule.py
+12
-8
没有找到文件。
theano/gof/cmodule.py
浏览文件 @
353cd469
...
@@ -266,6 +266,9 @@ class ModuleCache(object):
...
@@ -266,6 +266,9 @@ class ModuleCache(object):
warning
(
"Entry 1:"
,
self
.
entry_from_key
[
k1
])
warning
(
"Entry 1:"
,
self
.
entry_from_key
[
k1
])
warning
(
"hash 1:"
,
hash
(
k1
))
warning
(
"hash 1:"
,
hash
(
k1
))
age_thresh_use
=
60
*
60
*
24
*
24
"""The default age threshold for `clear_old` (in seconds)
"""
def
refresh
(
self
):
def
refresh
(
self
):
"""Update self.entry_from_key by walking the cache directory structure.
"""Update self.entry_from_key by walking the cache directory structure.
...
@@ -278,6 +281,7 @@ class ModuleCache(object):
...
@@ -278,6 +281,7 @@ class ModuleCache(object):
compilelock
.
get_lock
()
compilelock
.
get_lock
()
try
:
try
:
# 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
()
for
root
,
dirs
,
files
in
os
.
walk
(
self
.
dirname
):
for
root
,
dirs
,
files
in
os
.
walk
(
self
.
dirname
):
if
os
.
path
.
join
(
root
,
'key.pkl'
)
in
self
.
loaded_key_pkl
:
if
os
.
path
.
join
(
root
,
'key.pkl'
)
in
self
.
loaded_key_pkl
:
continue
continue
...
@@ -291,7 +295,7 @@ class ModuleCache(object):
...
@@ -291,7 +295,7 @@ class ModuleCache(object):
except
:
except
:
# the directory is still in use?? We just leave it for future removal.
# the directory is still in use?? We just leave it for future removal.
pass
pass
elif
'key.pkl'
in
files
:
elif
'key.pkl'
in
files
and
(
time_now
-
last_access_time
(
module_name_from_dir
(
root
)))
<
self
.
age_thresh_use
:
key_pkl
=
os
.
path
.
join
(
root
,
'key.pkl'
)
key_pkl
=
os
.
path
.
join
(
root
,
'key.pkl'
)
debug
(
'refresh adding'
,
key_pkl
)
debug
(
'refresh adding'
,
key_pkl
)
try
:
try
:
...
@@ -432,18 +436,18 @@ class ModuleCache(object):
...
@@ -432,18 +436,18 @@ class ModuleCache(object):
#debug('stats', self.stats, sum(self.stats))
#debug('stats', self.stats, sum(self.stats))
return
rval
return
rval
age_thresh
=
60
*
60
*
24
*
31
age_thresh
_del
=
60
*
60
*
24
*
31
"""The default age threshold for `clear_old` (in seconds)
"""The default age threshold for `clear_old` (in seconds)
"""
"""
def
clear_old
(
self
,
age_thresh
=
None
):
#default to a 31-day age_thresh
old
def
clear_old
(
self
,
age_thresh
_del
=
None
):
#default to a 31-day age_thresh_del
old
"""
"""
Delete entries from the filesystem for cache entries that are too old.
Delete entries from the filesystem for cache entries that are too old.
:param age_thresh
: dynamic modules whose last access time is more than ``age_thresh
``
:param age_thresh
_del: dynamic modules whose last access time is more than ``age_thresh_del
``
seconds ago will be erased.
seconds ago will be erased.
"""
"""
if
age_thresh
is
None
:
if
age_thresh
_del
is
None
:
age_thresh
=
self
.
age_thresh
age_thresh
_del
=
self
.
age_thresh_del
compilelock
.
get_lock
()
compilelock
.
get_lock
()
try
:
try
:
...
@@ -455,9 +459,9 @@ class ModuleCache(object):
...
@@ -455,9 +459,9 @@ class ModuleCache(object):
items_copy
=
list
(
self
.
entry_from_key
.
iteritems
())
items_copy
=
list
(
self
.
entry_from_key
.
iteritems
())
for
key
,
entry
in
items_copy
:
for
key
,
entry
in
items_copy
:
age
=
time_now
-
last_access_time
(
entry
)
age
=
time_now
-
last_access_time
(
entry
)
if
age
>
age_thresh
:
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 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
del
self
.
entry_from_key
[
key
]
del
self
.
entry_from_key
[
key
]
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论