Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
MindSpore
mindinsight
提交
8585e015
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看板
提交
8585e015
编写于
6月 18, 2020
作者:
M
mindspore-ci-bot
提交者:
Gitee
6月 18, 2020
浏览文件
操作
浏览文件
下载
差异文件
!281 add roboust check for summary watcher in case of FileNotFound exception
Merge pull request !281 from liangyongxiong/fix-summary-watcher
上级
283b7e6c
4913543f
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
34 addition
and
8 deletion
+34
-8
mindinsight/datavisual/data_transform/data_manager.py
mindinsight/datavisual/data_transform/data_manager.py
+12
-3
mindinsight/datavisual/data_transform/summary_watcher.py
mindinsight/datavisual/data_transform/summary_watcher.py
+22
-5
未找到文件。
mindinsight/datavisual/data_transform/data_manager.py
浏览文件 @
8585e015
...
...
@@ -42,6 +42,7 @@ from mindinsight.datavisual.data_transform.loader_generators.loader_generator im
from
mindinsight.datavisual.data_transform.loader_generators.data_loader_generator
import
DataLoaderGenerator
from
mindinsight.utils.exceptions
import
MindInsightException
from
mindinsight.utils.exceptions
import
ParamValueError
from
mindinsight.utils.exceptions
import
UnknownError
class
_BasicTrainJob
:
...
...
@@ -861,7 +862,7 @@ class DataManager:
# Let gunicorn load other modules first.
time
.
sleep
(
1
)
while
True
:
self
.
_load_data_in_thread
()
self
.
_load_data_in_thread
_wrapper
()
if
not
self
.
_reload_interval
:
break
...
...
@@ -874,18 +875,26 @@ class DataManager:
This function needs to be used after `start_load_data` function.
"""
logger
.
debug
(
"start to reload data"
)
thread
=
threading
.
Thread
(
target
=
self
.
_load_data_in_thread
,
thread
=
threading
.
Thread
(
target
=
self
.
_load_data_in_thread
_wrapper
,
name
=
'reload_data_thread'
)
thread
.
daemon
=
False
thread
.
start
()
def
_load_data_in_thread_wrapper
(
self
):
"""Wrapper for load data in thread."""
try
:
self
.
_load_data_in_thread
()
except
MindInsightException
as
exc
:
# Not raising the exception here to ensure that data reloading does not crash.
logger
.
warning
(
exc
.
message
)
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
raise
UnknownError
(
'Load data thread error.'
)
def
_load_data
(
self
):
"""This function will load data once and ignore it if the status is loading."""
...
...
mindinsight/datavisual/data_transform/summary_watcher.py
浏览文件 @
8585e015
...
...
@@ -209,8 +209,14 @@ class SummaryWatcher:
starting with "./" .
entry (DirEntry): Directory entry instance needed to check with regular expression.
"""
ctime
=
datetime
.
datetime
.
fromtimestamp
(
entry
.
stat
().
st_ctime
).
astimezone
()
mtime
=
datetime
.
datetime
.
fromtimestamp
(
entry
.
stat
().
st_mtime
).
astimezone
()
try
:
stat
=
entry
.
stat
()
except
FileNotFoundError
:
logger
.
warning
(
'File %s not found'
,
entry
.
name
)
return
ctime
=
datetime
.
datetime
.
fromtimestamp
(
stat
.
st_ctime
).
astimezone
()
mtime
=
datetime
.
datetime
.
fromtimestamp
(
stat
.
st_mtime
).
astimezone
()
if
entry
.
is_file
():
summary_pattern
=
re
.
search
(
self
.
SUMMARY_FILENAME_REGEX
,
entry
.
name
)
...
...
@@ -304,7 +310,13 @@ class SummaryWatcher:
return
False
def
_is_empty_directory
(
self
,
directory
):
return
not
bool
(
os
.
listdir
(
directory
))
try
:
count
=
len
(
os
.
listdir
(
directory
))
except
FileNotFoundError
:
logger
.
warning
(
'Directory %s not found.'
,
directory
)
count
=
0
return
not
bool
(
count
)
def
list_summary_directories_by_pagination
(
self
,
summary_base_dir
,
offset
=
0
,
limit
=
10
):
"""
...
...
@@ -388,8 +400,13 @@ class SummaryWatcher:
except
OverflowError
:
continue
# extract modified time from filesystem
mtime
=
datetime
.
datetime
.
fromtimestamp
(
entry
.
stat
().
st_mtime
).
astimezone
()
try
:
stat
=
entry
.
stat
()
except
FileNotFoundError
:
logger
.
warning
(
'File %s not found.'
,
entry
.
name
)
continue
mtime
=
datetime
.
datetime
.
fromtimestamp
(
stat
.
st_mtime
).
astimezone
()
summaries
.
append
({
'file_name'
:
entry
.
name
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录