Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
MindSpore
mindinsight
提交
98516a84
M
mindinsight
项目概览
MindSpore
/
mindinsight
通知
7
Star
3
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看板
提交
98516a84
编写于
5月 22, 2020
作者:
M
mindspore-ci-bot
提交者:
Gitee
5月 22, 2020
浏览文件
操作
浏览文件
下载
差异文件
!140 clean lineage when train lineage comes in, add test cases for lineage cache
Merge pull request !140 from luopengting/lineage_test
上级
d7078a55
98ec661b
变更
6
显示空白变更内容
内联
并排
Showing
6 changed file
with
126 addition
and
10 deletion
+126
-10
mindinsight/lineagemgr/api/model.py
mindinsight/lineagemgr/api/model.py
+3
-0
mindinsight/lineagemgr/common/validator/validate.py
mindinsight/lineagemgr/common/validator/validate.py
+1
-2
mindinsight/lineagemgr/querier/query_model.py
mindinsight/lineagemgr/querier/query_model.py
+5
-0
tests/st/func/lineagemgr/api/test_model_api.py
tests/st/func/lineagemgr/api/test_model_api.py
+0
-8
tests/st/func/lineagemgr/cache/__init__.py
tests/st/func/lineagemgr/cache/__init__.py
+14
-0
tests/st/func/lineagemgr/cache/test_lineage_cache.py
tests/st/func/lineagemgr/cache/test_lineage_cache.py
+103
-0
未找到文件。
mindinsight/lineagemgr/api/model.py
浏览文件 @
98516a84
...
...
@@ -90,6 +90,9 @@ def general_get_summary_lineage(data_manager=None, summary_dir=None, keys=None):
default_result
=
{}
if
data_manager
is
None
and
summary_dir
is
None
:
raise
LineageParamTypeError
(
"One of data_manager or summary_dir needs to be specified."
)
if
data_manager
is
not
None
and
summary_dir
is
None
:
raise
LineageParamTypeError
(
"If data_manager is specified, the summary_dir needs to be "
"specified as relative path."
)
if
keys
is
not
None
:
validate_filter_key
(
keys
)
...
...
mindinsight/lineagemgr/common/validator/validate.py
浏览文件 @
98516a84
...
...
@@ -497,8 +497,7 @@ def validate_added_info(added_info: dict):
"""
added_info_keys
=
[
"tag"
,
"remark"
]
if
not
set
(
added_info
.
keys
()).
issubset
(
added_info_keys
):
err_msg
=
"Keys must be in {}."
.
format
(
added_info_keys
)
log
.
error
(
err_msg
)
err_msg
=
"Keys of added_info must be in {}."
.
format
(
added_info_keys
)
raise
LineageParamValueError
(
err_msg
)
for
key
,
value
in
added_info
.
items
():
...
...
mindinsight/lineagemgr/querier/query_model.py
浏览文件 @
98516a84
...
...
@@ -112,6 +112,11 @@ class LineageObj:
dataset_graph
=
kwargs
.
get
(
'dataset_graph'
)
if
not
any
([
train_lineage
,
evaluation_lineage
,
dataset_graph
]):
raise
LineageEventNotExistException
()
# If new train lineage, will clean the lineage saved before.
if
train_lineage
is
not
None
or
dataset_graph
is
not
None
:
self
.
_init_lineage
()
self
.
_parse_user_defined_info
(
user_defined_info_list
)
self
.
_parse_train_lineage
(
train_lineage
)
self
.
_parse_evaluation_lineage
(
evaluation_lineage
)
...
...
tests/st/func/lineagemgr/api/test_model_api.py
浏览文件 @
98516a84
...
...
@@ -157,14 +157,6 @@ class TestModelApi(TestCase):
cls
.
empty_dir
=
os
.
path
.
join
(
BASE_SUMMARY_DIR
,
'empty_dir'
)
os
.
makedirs
(
cls
.
empty_dir
)
def
generate_lineage_object
(
self
,
lineage
):
lineage
=
dict
(
lineage
)
lineage_object
=
dict
()
lineage_object
.
update
({
'summary_dir'
:
lineage
.
pop
(
'summary_dir'
)})
lineage_object
.
update
({
'dataset_graph'
:
lineage
.
pop
(
'dataset_graph'
)})
lineage_object
.
update
({
'model_lineage'
:
lineage
})
return
lineage_object
@
pytest
.
mark
.
level0
@
pytest
.
mark
.
platform_arm_ascend_training
@
pytest
.
mark
.
platform_x86_gpu_training
...
...
tests/st/func/lineagemgr/cache/__init__.py
0 → 100644
浏览文件 @
98516a84
# Copyright 2020 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ============================================================================
tests/st/func/lineagemgr/cache/test_lineage_cache.py
0 → 100644
浏览文件 @
98516a84
# Copyright 2020 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ============================================================================
"""
Function:
Test the query module about lineage information.
Usage:
The query module test should be run after lineagemgr/collection/model/test_model_lineage.py
pytest lineagemgr
"""
from
unittest
import
TestCase
import
pytest
from
mindinsight.datavisual.data_transform.data_manager
import
DataManager
from
mindinsight.lineagemgr.cache_item_updater
import
LineageCacheItemUpdater
from
mindinsight.lineagemgr.api.model
import
general_filter_summary_lineage
,
\
general_get_summary_lineage
from
..api.test_model_api
import
LINEAGE_INFO_RUN1
,
LINEAGE_FILTRATION_EXCEPT_RUN
,
\
LINEAGE_FILTRATION_RUN1
,
LINEAGE_FILTRATION_RUN2
from
..conftest
import
BASE_SUMMARY_DIR
from
.....ut.lineagemgr.querier
import
event_data
from
.....utils.tools
import
check_loading_done
@
pytest
.
mark
.
usefixtures
(
"create_summary_dir"
)
class
TestModelApi
(
TestCase
):
"""Test get lineage from data_manager."""
@
classmethod
def
setup_class
(
cls
):
data_manager
=
DataManager
(
BASE_SUMMARY_DIR
)
data_manager
.
register_brief_cache_item_updater
(
LineageCacheItemUpdater
())
data_manager
.
start_load_data
(
reload_interval
=
0
)
check_loading_done
(
data_manager
)
cls
.
_data_manger
=
data_manager
@
pytest
.
mark
.
level0
@
pytest
.
mark
.
platform_arm_ascend_training
@
pytest
.
mark
.
platform_x86_gpu_training
@
pytest
.
mark
.
platform_x86_ascend_training
@
pytest
.
mark
.
platform_x86_cpu
@
pytest
.
mark
.
env_single
def
test_get_summary_lineage
(
self
):
"""Test the interface of get_summary_lineage."""
total_res
=
general_get_summary_lineage
(
data_manager
=
self
.
_data_manger
,
summary_dir
=
"./run1"
)
expect_total_res
=
LINEAGE_INFO_RUN1
assert
expect_total_res
==
total_res
@
pytest
.
mark
.
level0
@
pytest
.
mark
.
platform_arm_ascend_training
@
pytest
.
mark
.
platform_x86_gpu_training
@
pytest
.
mark
.
platform_x86_ascend_training
@
pytest
.
mark
.
platform_x86_cpu
@
pytest
.
mark
.
env_single
def
test_filter_summary_lineage
(
self
):
"""Test the interface of filter_summary_lineage."""
expect_result
=
{
'customized'
:
event_data
.
CUSTOMIZED__0
,
'object'
:
[
LINEAGE_FILTRATION_EXCEPT_RUN
,
LINEAGE_FILTRATION_RUN1
,
LINEAGE_FILTRATION_RUN2
],
'count'
:
3
}
search_condition
=
{
'sorted_name'
:
'summary_dir'
}
res
=
general_filter_summary_lineage
(
data_manager
=
self
.
_data_manger
,
search_condition
=
search_condition
)
expect_objects
=
expect_result
.
get
(
'object'
)
for
idx
,
res_object
in
enumerate
(
res
.
get
(
'object'
)):
expect_objects
[
idx
][
'model_lineage'
][
'dataset_mark'
]
=
res_object
[
'model_lineage'
].
get
(
'dataset_mark'
)
assert
expect_result
==
res
expect_result
=
{
'customized'
:
{},
'object'
:
[],
'count'
:
0
}
search_condition
=
{
'summary_dir'
:
{
"in"
:
[
'./dir_with_empty_lineage'
]
}
}
res
=
general_filter_summary_lineage
(
data_manager
=
self
.
_data_manger
,
search_condition
=
search_condition
)
assert
expect_result
==
res
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录