提交 70857c7b 编写于 作者: Y yuximiao

adapt profiling source path change

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