From 87f7ca226d7c819461f9b167196126c12c019d74 Mon Sep 17 00:00:00 2001 From: gzhcv Date: Mon, 28 Dec 2020 20:46:05 +0800 Subject: [PATCH] Fix the bug of write file which exist --- mindspore/profiler/parser/step_trace_parser.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/mindspore/profiler/parser/step_trace_parser.py b/mindspore/profiler/parser/step_trace_parser.py index 9e3e005b2b..29d82eb54a 100644 --- a/mindspore/profiler/parser/step_trace_parser.py +++ b/mindspore/profiler/parser/step_trace_parser.py @@ -380,7 +380,8 @@ class GpuStepTraceParser(BaseStepTraceParser): points = { 'fp_start': fp_start_name, } - + if os.path.exists(output_path): + return points try: with open(output_path, 'w') as json_file: json.dump(points, json_file) @@ -486,7 +487,8 @@ class AscendStepTraceParser(BaseStepTraceParser): points = { 'fp_start': point_info.get(self._fp_tag, ''), } - + if os.path.exists(output_path): + return points try: with open(output_path, 'w') as json_file: json.dump(points, json_file)