From 72722843db414e88d9163f9877f21faef5308d90 Mon Sep 17 00:00:00 2001 From: yuximiao Date: Thu, 27 Aug 2020 16:03:45 +0800 Subject: [PATCH] fix __del__ in Profiler --- mindspore/profiler/profiling.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/mindspore/profiler/profiling.py b/mindspore/profiler/profiling.py index 6fb9cd98872..9c5f533aa84 100644 --- a/mindspore/profiler/profiling.py +++ b/mindspore/profiler/profiling.py @@ -205,6 +205,9 @@ class Profiler: except (ProfilerIOException, ProfilerFileNotFoundException, RuntimeError) as err: logger.warning('Fail to write timeline data: %s', err) + os.environ['PROFILING_MODE'] = str("false") + context.set_context(enable_profiling=False) + def _analyse_step_trace(self, source_path, framework_parser): """ Analyse step trace data and save the result. @@ -275,11 +278,6 @@ class Profiler: timeline_analyser.write_timeline() timeline_analyser.write_timeline_summary() - def __del__(self): - """Disable the profiling collection service, called after training.""" - os.environ['PROFILING_MODE'] = str("false") - context.set_context(enable_profiling=False) - def _get_profiling_job_id(self): """Get profiling job id, which was generated by ada service.