提交 51e2cb3a 编写于 作者: M mindspore-ci-bot 提交者: Gitee

!33 catch DecodeError when parsing, enhance sorting when TypeError

Merge pull request !33 from luopengting/enhance_parse_and_sort
......@@ -105,10 +105,14 @@ class ExpressionType(enum.Enum):
cls.LE.value, cls.GE.value]:
return False
if except_key == cls.IN.value:
state = operator.contains(except_value, actual_value)
else:
state = getattr(operator, except_key)(actual_value, except_value)
try:
if except_key == cls.IN.value:
state = operator.contains(except_value, actual_value)
else:
state = getattr(operator, except_key)(actual_value, except_value)
except TypeError:
# actual_value can not compare with except_value
return False
return state
......@@ -280,8 +284,12 @@ class Querier:
elif value2 is None:
cmp_result = 1
else:
cmp_result = (value1 > value2) - (value1 < value2)
try:
cmp_result = (value1 > value2) - (value1 < value2)
except TypeError:
type1 = str(type(value1))
type2 = str(type(value2))
cmp_result = (type1 > type2) - (type1 < type2)
return cmp_result
self._parse_fail_summary_logs()
......
......@@ -18,6 +18,7 @@ from collections import namedtuple
from enum import Enum
from google.protobuf.json_format import MessageToDict
from google.protobuf.message import DecodeError
from mindinsight.datavisual.proto_files.mindinsight_lineage_pb2 import LineageEvent
from mindinsight.datavisual.utils import crc32
......@@ -202,7 +203,7 @@ class LineageSummaryAnalyzer(SummaryAnalyzer):
analyzer = cls(file_path)
try:
lineage_info = analyzer.get_latest_info()
except (MindInsightException, IOError) as err:
except (MindInsightException, IOError, DecodeError) as err:
log.error("Failed to get lineage information.")
log.exception(err)
raise LineageSummaryAnalyzeException()
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册