Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
9f0f4fd8
提交
9f0f4fd8
authored
12月 05, 2011
作者:
Olivier Delalleau
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Added new command 'theano-cache unlock'
This can be used to unlock the compilation directory without having to wait two minutes, or having to manually delete a file.
上级
2d774b33
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
24 行增加
和
2 行删除
+24
-2
theano-cache
bin/theano-cache
+4
-0
compilelock.py
theano/gof/compilelock.py
+20
-2
没有找到文件。
bin/theano-cache
浏览文件 @
9f0f4fd8
...
@@ -28,10 +28,14 @@ elif sys.argv[1] in ('clear'):
...
@@ -28,10 +28,14 @@ elif sys.argv[1] in ('clear'):
(
len
(
items
),
', '
.
join
(
items
)))
(
len
(
items
),
', '
.
join
(
items
)))
elif
sys
.
argv
[
1
]
in
(
'list'
):
elif
sys
.
argv
[
1
]
in
(
'list'
):
theano
.
gof
.
compiledir
.
print_compiledir_content
()
theano
.
gof
.
compiledir
.
print_compiledir_content
()
elif
sys
.
argv
[
1
]
==
'unlock'
:
theano
.
gof
.
compilelock
.
force_unlock
()
print
'Lock successfully removed!'
else
:
else
:
print
'command "
%
s" not recognized'
%
sys
.
argv
[
1
]
print
'command "
%
s" not recognized'
%
sys
.
argv
[
1
]
print
'Type "theano-cache" to print the cache location'
print
'Type "theano-cache" to print the cache location'
print
'Type "theano-cache clear" to erase the cache'
print
'Type "theano-cache clear" to erase the cache'
print
'Type "theano-cache list" to print the cache content'
print
'Type "theano-cache list" to print the cache content'
print
'Type "theano-cache unlock" to unlock the cache directory'
sys
.
exit
(
1
)
sys
.
exit
(
1
)
theano/gof/compilelock.py
浏览文件 @
9f0f4fd8
...
@@ -21,9 +21,27 @@ timeout_before_override = 120
...
@@ -21,9 +21,27 @@ timeout_before_override = 120
# 'refresh_every' seconds.
# 'refresh_every' seconds.
refresh_every
=
60
refresh_every
=
60
def
get_lock
():
def
force_unlock
():
"""
Delete the compilation lock if someone else has it.
"""
global
timeout_before_override
timeout_backup
=
timeout_before_override
timeout_before_override
=
0
try
:
get_lock
(
min_wait
=
0
,
max_wait
=
0.001
)
release_lock
()
finally
:
timeout_before_override
=
timeout_backup
def
get_lock
(
**
kw
):
"""
"""
Obtain lock on compilation directory.
Obtain lock on compilation directory.
:param kw: Additional arguments to be forwarded to the `lock` function when
acquiring the lock.
"""
"""
if
not
hasattr
(
get_lock
,
'n_lock'
):
if
not
hasattr
(
get_lock
,
'n_lock'
):
# Initialization.
# Initialization.
...
@@ -47,7 +65,7 @@ def get_lock():
...
@@ -47,7 +65,7 @@ def get_lock():
if
get_lock
.
lock_is_enabled
:
if
get_lock
.
lock_is_enabled
:
# Only really try to acquire the lock if we do not have it already.
# Only really try to acquire the lock if we do not have it already.
if
get_lock
.
n_lock
==
0
:
if
get_lock
.
n_lock
==
0
:
lock
(
get_lock
.
lock_dir
,
timeout
=
timeout_before_override
)
lock
(
get_lock
.
lock_dir
,
timeout
=
timeout_before_override
,
**
kw
)
atexit
.
register
(
Unlocker
.
unlock
,
get_lock
.
unlocker
)
atexit
.
register
(
Unlocker
.
unlock
,
get_lock
.
unlocker
)
# Store time at which the lock was set.
# Store time at which the lock was set.
get_lock
.
start_time
=
time
.
time
()
get_lock
.
start_time
=
time
.
time
()
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论