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

!302 Adapt the change of profiling source path.

Merge pull request !302 from yuximiao/master
......@@ -66,7 +66,7 @@ def get_profile_op_info():
search_condition = request.stream.read()
try:
search_condition = json.loads(search_condition if search_condition else "{}")
except Exception:
except (json.JSONDecodeError, ValueError):
raise ParamValueError("Json data parse failed.")
validate_condition(search_condition)
......
......@@ -107,12 +107,11 @@ class MinddataAnalyser(BaseAnalyser):
device_queue_file_path = MinddataAnalyser.find_target_file(self._profiling_dir, device_queue_file_name)
feed_file_name = "dataset_iterator_profiling_" + self._device_id + ".txt"
feed_file_path = MinddataAnalyser.find_target_file(self._profiling_dir, feed_file_name)
file_path = ""
if device_queue_file_path:
file_path = device_queue_file_path
elif not device_queue_file_path and feed_file_path:
file_path = feed_file_path
else:
file_path = ""
if file_path:
with open(file_path) as data_file:
......
......@@ -77,12 +77,17 @@ class MinddataParser:
col_names = ["node_name", "start_time", "end_time", "queue_size"]
minddata_aicpu_source_path = get_file_join_name(
input_path=source_path, file_name='DATA_PREPROCESS.dev.AICPUMI')
if not minddata_aicpu_source_path:
minddata_aicpu_source_path = get_file_join_name(
input_path=os.path.join(source_path, "data"), file_name='DATA_PREPROCESS.dev.AICPUMI')
if not minddata_aicpu_source_path:
raise RuntimeError("Fail to get AICPUMI file.")
minddata_aicpu_output_path = os.path.join(output_path, "minddata_aicpu_" + device_id + ".txt")
if minddata_aicpu_source_path:
minddata_aicpu_data = MinddataParser.parse_minddata_aicpu_data(minddata_aicpu_source_path)
if minddata_aicpu_data:
fwrite_format(
minddata_aicpu_output_path,
tabulate(minddata_aicpu_data, col_names, tablefmt='simple'),
is_start=True
)
minddata_aicpu_data = MinddataParser.parse_minddata_aicpu_data(minddata_aicpu_source_path)
if minddata_aicpu_data:
fwrite_format(
minddata_aicpu_output_path,
tabulate(minddata_aicpu_data, col_names, tablefmt='simple'),
is_start=True
)
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册