Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
MindSpore
mindinsight
提交
7cecabbf
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看板
提交
7cecabbf
编写于
6月 11, 2020
作者:
M
mindspore-ci-bot
提交者:
Gitee
6月 11, 2020
浏览文件
操作
浏览文件
下载
差异文件
!251 add the function of checking whether the operator name exists in framework file
Merge pull request !251 from chenchao99/profiler_20200610
上级
af74f87d
6e9fedba
变更
5
显示空白变更内容
内联
并排
Showing
5 changed file
with
42 addition
and
2 deletion
+42
-2
mindinsight/profiler/analyser/analyser.py
mindinsight/profiler/analyser/analyser.py
+1
-0
mindinsight/profiler/analyser/base_analyser.py
mindinsight/profiler/analyser/base_analyser.py
+4
-1
mindinsight/profiler/common/exceptions/error_code.py
mindinsight/profiler/common/exceptions/error_code.py
+2
-0
mindinsight/profiler/common/exceptions/exceptions.py
mindinsight/profiler/common/exceptions/exceptions.py
+11
-0
mindinsight/profiler/parser/framework_parser.py
mindinsight/profiler/parser/framework_parser.py
+24
-1
未找到文件。
mindinsight/profiler/analyser/analyser.py
浏览文件 @
7cecabbf
...
@@ -93,6 +93,7 @@ class AicoreDetailAnalyser(BaseAnalyser):
...
@@ -93,6 +93,7 @@ class AicoreDetailAnalyser(BaseAnalyser):
self
.
_none_filter_condition_key
=
[
self
.
_none_filter_condition_key
=
[
'is_display_detail'
,
'is_display_full_op_name'
'is_display_detail'
,
'is_display_full_op_name'
]
]
self
.
_none_sort_col_names
=
[
'op_info'
]
def
query_and_sort_by_op_type
(
self
,
filter_condition
,
op_type_order
:
list
):
def
query_and_sort_by_op_type
(
self
,
filter_condition
,
op_type_order
:
list
):
"""
"""
...
...
mindinsight/profiler/analyser/base_analyser.py
浏览文件 @
7cecabbf
...
@@ -20,7 +20,7 @@ from marshmallow import ValidationError
...
@@ -20,7 +20,7 @@ from marshmallow import ValidationError
from
mindinsight.profiler.common.exceptions.exceptions
import
\
from
mindinsight.profiler.common.exceptions.exceptions
import
\
ProfilerColumnNotExistException
,
ProfilerPathErrorException
,
\
ProfilerColumnNotExistException
,
ProfilerPathErrorException
,
\
ProfilerIOException
ProfilerIOException
,
ProfilerColumnNotSupportSortException
from
mindinsight.profiler.common.log
import
logger
from
mindinsight.profiler.common.log
import
logger
from
mindinsight.profiler.common.validator.validate_path
import
\
from
mindinsight.profiler.common.validator.validate_path
import
\
validate_and_normalize_path
validate_and_normalize_path
...
@@ -50,6 +50,7 @@ class BaseAnalyser(ABC):
...
@@ -50,6 +50,7 @@ class BaseAnalyser(ABC):
self
.
_display_col_names
=
None
self
.
_display_col_names
=
None
self
.
_size
=
0
self
.
_size
=
0
self
.
_none_filter_condition_key
=
[]
self
.
_none_filter_condition_key
=
[]
self
.
_none_sort_col_names
=
[]
try
:
try
:
self
.
_load
()
self
.
_load
()
...
@@ -150,6 +151,8 @@ class BaseAnalyser(ABC):
...
@@ -150,6 +151,8 @@ class BaseAnalyser(ABC):
index
=
self
.
__col_names__
.
index
(
sort_name
)
index
=
self
.
__col_names__
.
index
(
sort_name
)
except
ValueError
:
except
ValueError
:
raise
ProfilerColumnNotExistException
(
sort_name
)
raise
ProfilerColumnNotExistException
(
sort_name
)
if
self
.
_none_sort_col_names
and
sort_name
in
self
.
_none_sort_col_names
:
raise
ProfilerColumnNotSupportSortException
(
sort_name
)
self
.
_result
.
sort
(
key
=
functools
.
cmp_to_key
(
_cmp
),
reverse
=
reverse
)
self
.
_result
.
sort
(
key
=
functools
.
cmp_to_key
(
_cmp
),
reverse
=
reverse
)
def
_group
(
self
,
group_condition
:
dict
):
def
_group
(
self
,
group_condition
:
dict
):
...
...
mindinsight/profiler/common/exceptions/error_code.py
浏览文件 @
7cecabbf
...
@@ -46,6 +46,7 @@ class ProfilerErrors(ProfilerMgrErrors):
...
@@ -46,6 +46,7 @@ class ProfilerErrors(ProfilerMgrErrors):
GROUP_CONDITION_ERROR
=
4
|
_ANALYSER_MASK
GROUP_CONDITION_ERROR
=
4
|
_ANALYSER_MASK
SORT_CONDITION_ERROR
=
5
|
_ANALYSER_MASK
SORT_CONDITION_ERROR
=
5
|
_ANALYSER_MASK
FILTER_CONDITION_ERROR
=
6
|
_ANALYSER_MASK
FILTER_CONDITION_ERROR
=
6
|
_ANALYSER_MASK
COLUMN_NOT_SUPPORT_SORT_ERROR
=
7
|
_ANALYSER_MASK
@
unique
@
unique
...
@@ -71,3 +72,4 @@ class ProfilerErrorMsg(Enum):
...
@@ -71,3 +72,4 @@ class ProfilerErrorMsg(Enum):
OP_TYPE_ERROR
=
'The op_type in search_condition error, {}'
OP_TYPE_ERROR
=
'The op_type in search_condition error, {}'
GROUP_CONDITION_ERROR
=
'The group_condition in search_condition error, {}'
GROUP_CONDITION_ERROR
=
'The group_condition in search_condition error, {}'
SORT_CONDITION_ERROR
=
'The sort_condition in search_condition error, {}'
SORT_CONDITION_ERROR
=
'The sort_condition in search_condition error, {}'
COLUMN_NOT_SUPPORT_SORT_ERROR
=
'The column {} does not support to sort.'
mindinsight/profiler/common/exceptions/exceptions.py
浏览文件 @
7cecabbf
...
@@ -181,3 +181,14 @@ class ProfilerGroupConditionException(MindInsightException):
...
@@ -181,3 +181,14 @@ class ProfilerGroupConditionException(MindInsightException):
message
=
ProfilerErrorMsg
.
GROUP_CONDITION_ERROR
.
value
.
format
(
msg
),
message
=
ProfilerErrorMsg
.
GROUP_CONDITION_ERROR
.
value
.
format
(
msg
),
http_code
=
400
http_code
=
400
)
)
class
ProfilerColumnNotSupportSortException
(
MindInsightException
):
"""The column does not support to sort error in profiler module."""
def
__init__
(
self
,
msg
):
super
(
ProfilerColumnNotSupportSortException
,
self
).
__init__
(
error
=
ProfilerErrors
.
COLUMN_NOT_SUPPORT_SORT_ERROR
,
message
=
ProfilerErrorMsg
.
COLUMN_NOT_SUPPORT_SORT_ERROR
.
value
.
format
(
msg
),
http_code
=
400
)
mindinsight/profiler/parser/framework_parser.py
浏览文件 @
7cecabbf
...
@@ -24,7 +24,7 @@ from marshmallow import ValidationError
...
@@ -24,7 +24,7 @@ from marshmallow import ValidationError
from
mindinsight.profiler.common.exceptions.exceptions
import
\
from
mindinsight.profiler.common.exceptions.exceptions
import
\
ProfilerPathErrorException
,
ProfilerDirNotFoundException
,
\
ProfilerPathErrorException
,
ProfilerDirNotFoundException
,
\
ProfilerFileNotFoundException
,
ProfilerDeviceIdMismatchException
,
\
ProfilerFileNotFoundException
,
ProfilerDeviceIdMismatchException
,
\
ProfilerRawFileException
ProfilerRawFileException
,
ProfilerParamValueErrorException
from
mindinsight.profiler.common.validator.validate_path
import
\
from
mindinsight.profiler.common.validator.validate_path
import
\
validate_and_normalize_path
validate_and_normalize_path
...
@@ -223,6 +223,29 @@ class FrameworkParser:
...
@@ -223,6 +223,29 @@ class FrameworkParser:
self
.
_parse_graph_files_and_save
(
self
.
_task_cache
)
self
.
_parse_graph_files_and_save
(
self
.
_task_cache
)
del
self
.
_task_cache
del
self
.
_task_cache
def
check_op_name
(
self
,
op_name
,
is_prefix
=
True
):
"""
Check whether the operator name exists.
Args:
op_name (str): The operator name or operator name prefix.
is_prefix (bool): `True` if the op_name is prefix, else `False`.
Default: True.
Returns:
bool, `True` if the operator name does exist in framework file, else
`False`.
"""
if
not
op_name
:
raise
ProfilerParamValueErrorException
(
'The op_name should exist.'
)
for
full_op_name
in
self
.
_task_id_full_op_name_dict
.
values
():
if
full_op_name
:
if
is_prefix
and
full_op_name
.
startswith
(
op_name
):
return
True
if
not
is_prefix
and
op_name
==
full_op_name
:
return
True
return
False
def
_get_raw_profiling_path
(
self
,
profiling_id
):
def
_get_raw_profiling_path
(
self
,
profiling_id
):
"""
"""
Get raw profiling path.
Get raw profiling path.
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录