Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
MindSpore
mindinsight
提交
c63a32b0
M
mindinsight
项目概览
MindSpore
/
mindinsight
通知
8
Star
4
Fork
2
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
M
mindinsight
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
c63a32b0
编写于
5月 15, 2020
作者:
W
wenkai
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
log exception raised by new thread to help debugging
上级
aeac0039
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
12 addition
and
4 deletion
+12
-4
mindinsight/datavisual/data_transform/data_manager.py
mindinsight/datavisual/data_transform/data_manager.py
+12
-4
未找到文件。
mindinsight/datavisual/data_transform/data_manager.py
浏览文件 @
c63a32b0
...
@@ -759,17 +759,17 @@ class DataManager:
...
@@ -759,17 +759,17 @@ class DataManager:
self
.
_reload_interval
=
reload_interval
self
.
_reload_interval
=
reload_interval
self
.
_max_threads_count
=
max_threads_count
self
.
_max_threads_count
=
max_threads_count
thread
=
threading
.
Thread
(
target
=
self
.
_reload_data
,
thread
=
threading
.
Thread
(
target
=
self
.
_reload_data
_in_thread
,
name
=
'start_load_data_thread'
)
name
=
'start_load_data_thread'
)
thread
.
daemon
=
True
thread
.
daemon
=
True
thread
.
start
()
thread
.
start
()
def
_reload_data
(
self
):
def
_reload_data
_in_thread
(
self
):
"""This function periodically loads the data."""
"""This function periodically loads the data."""
# Let gunicorn load other modules first.
# Let gunicorn load other modules first.
time
.
sleep
(
1
)
time
.
sleep
(
1
)
while
True
:
while
True
:
self
.
_load_data
()
self
.
_load_data
_in_thread
()
if
not
self
.
_reload_interval
:
if
not
self
.
_reload_interval
:
break
break
...
@@ -782,11 +782,19 @@ class DataManager:
...
@@ -782,11 +782,19 @@ class DataManager:
This function needs to be used after `start_load_data` function.
This function needs to be used after `start_load_data` function.
"""
"""
logger
.
debug
(
"start to reload data"
)
logger
.
debug
(
"start to reload data"
)
thread
=
threading
.
Thread
(
target
=
self
.
_load_data
,
thread
=
threading
.
Thread
(
target
=
self
.
_load_data
_in_thread
,
name
=
'reload_data_thread'
)
name
=
'reload_data_thread'
)
thread
.
daemon
=
False
thread
.
daemon
=
False
thread
.
start
()
thread
.
start
()
def
_load_data_in_thread
(
self
):
"""Log (but not swallow) exceptions in thread to help debugging."""
try
:
self
.
_load_data
()
except
Exception
as
exc
:
logger
.
exception
(
exc
)
raise
def
_load_data
(
self
):
def
_load_data
(
self
):
"""This function will load data once and ignore it if the status is loading."""
"""This function will load data once and ignore it if the status is loading."""
logger
.
info
(
"Start to load data, reload interval: %r."
,
self
.
_reload_interval
)
logger
.
info
(
"Start to load data, reload interval: %r."
,
self
.
_reload_interval
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录