Skip to content

Commit

Permalink
initialize profiler only if init is called and it is not in preload mode
Browse files Browse the repository at this point in the history
  • Loading branch information
hariharan-devarajan committed Oct 6, 2023
1 parent 98c344f commit a85a22d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions dlio_profiler/logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
DLIO_PROFILER_ENABLE = True if os.getenv("DLIO_PROFILER_ENABLE", '1') == '1' else False
DLIO_PROFILER_INIT_PRELOAD = True if os.getenv("DLIO_PROFILER_INIT", 'PRELOAD') == 'PRELOAD' else False


if DLIO_PROFILER_ENABLE:
import dlio_profiler_py as profiler

from pathlib import Path
import inspect
Expand Down Expand Up @@ -45,7 +46,6 @@ def initialize_log(logfile, data_dir, process_id):
os.makedirs(log_file.parent, exist_ok=True)
if os.path.isfile(log_file):
os.remove(log_file)
import dlio_profiler_py as profiler
instance.logger = profiler
instance.logger.initialize(f"{instance.logfile}", f"{data_dir}", process_id=process_id)
return instance
Expand Down

0 comments on commit a85a22d

Please sign in to comment.