From a4f74686596059d95fd2471be6f656cdeec60c33 Mon Sep 17 00:00:00 2001 From: Joel Tony Date: Fri, 7 Jun 2024 19:32:49 +0530 Subject: [PATCH 01/11] feat: Export directory prefix (Darshan) --- drishti/handlers/handle_darshan.py | 15 ++- drishti/includes/module.py | 147 +++++++++++++++++------------ drishti/includes/parser.py | 11 +++ 3 files changed, 102 insertions(+), 71 deletions(-) diff --git a/drishti/handlers/handle_darshan.py b/drishti/handlers/handle_darshan.py index d47fbea..1270d7c 100644 --- a/drishti/handlers/handle_darshan.py +++ b/drishti/handlers/handle_darshan.py @@ -752,15 +752,12 @@ def handler(): display_thresholds(console) display_footer(console, insights_start_time, insights_end_time) - filename = '{}.html'.format(args.log_path) - export_html(console, filename) + input_filename = os.path.basename(args.log_path).replace('.darshan', '') + out_dir = args.export_dir if args.export_dir != "" else os.getcwd() - filename = '{}.svg'.format(args.log_path) - export_svg(console, filename) + print(f"DEBUG: outfile_name: {input_filename}") - filename = '{}-summary.csv'.format( - args.log_path.replace('.darshan', '') - ) - - export_csv(filename, job['job']['jobid']) + export_html(console, out_dir, input_filename) + export_svg(console, out_dir, input_filename) + export_csv(out_dir, input_filename, job['job']['jobid']) diff --git a/drishti/includes/module.py b/drishti/includes/module.py index dedaa09..0e69430 100644 --- a/drishti/includes/module.py +++ b/drishti/includes/module.py @@ -1823,76 +1823,99 @@ def display_footer(console, insights_start_time, insights_end_time): ) ) -def export_html(console, filename): +def export_html(console, export_dir, filename): ''' ''' - if args.export_html: - console.save_html( - filename, - theme=set_export_theme(), - clear=False - ) + if not args.export_html: + print("DEBUG: export_html() - return") + return + os.makedirs(export_dir, exist_ok=True) + filepath = os.path.join(export_dir, f"{filename}.html") -def export_svg(console, filename): - if args.export_svg: - console.save_svg( - filename, - title='Drishti', - theme=set_export_theme(), - clear=False - ) + console.save_html( + filepath, + theme=set_export_theme(), + clear=False + ) + print("DEBUG: END export_html()") -def export_csv(filename, jobid=None): - if args.export_csv: - issues = [ - 'JOB', - INSIGHTS_STDIO_HIGH_USAGE, - INSIGHTS_POSIX_WRITE_COUNT_INTENSIVE, - INSIGHTS_POSIX_READ_COUNT_INTENSIVE, - INSIGHTS_POSIX_WRITE_SIZE_INTENSIVE, - INSIGHTS_POSIX_READ_SIZE_INTENSIVE, - INSIGHTS_POSIX_HIGH_SMALL_READ_REQUESTS_USAGE, - INSIGHTS_POSIX_HIGH_SMALL_WRITE_REQUESTS_USAGE, - INSIGHTS_POSIX_HIGH_MISALIGNED_MEMORY_USAGE, - INSIGHTS_POSIX_HIGH_MISALIGNED_FILE_USAGE, - INSIGHTS_POSIX_REDUNDANT_READ_USAGE, - INSIGHTS_POSIX_REDUNDANT_WRITE_USAGE, - INSIGHTS_POSIX_HIGH_RANDOM_READ_USAGE, - INSIGHTS_POSIX_HIGH_SEQUENTIAL_READ_USAGE, - INSIGHTS_POSIX_HIGH_RANDOM_WRITE_USAGE, - INSIGHTS_POSIX_HIGH_SEQUENTIAL_WRITE_USAGE, - INSIGHTS_POSIX_HIGH_SMALL_READ_REQUESTS_SHARED_FILE_USAGE, - INSIGHTS_POSIX_HIGH_SMALL_WRITE_REQUESTS_SHARED_FILE_USAGE, - INSIGHTS_POSIX_HIGH_METADATA_TIME, - INSIGHTS_POSIX_SIZE_IMBALANCE, - INSIGHTS_POSIX_TIME_IMBALANCE, - INSIGHTS_POSIX_INDIVIDUAL_WRITE_SIZE_IMBALANCE, - INSIGHTS_POSIX_INDIVIDUAL_READ_SIZE_IMBALANCE, - INSIGHTS_MPI_IO_NO_USAGE, - INSIGHTS_MPI_IO_NO_COLLECTIVE_READ_USAGE, - INSIGHTS_MPI_IO_NO_COLLECTIVE_WRITE_USAGE, - INSIGHTS_MPI_IO_COLLECTIVE_READ_USAGE, - INSIGHTS_MPI_IO_COLLECTIVE_WRITE_USAGE, - INSIGHTS_MPI_IO_BLOCKING_READ_USAGE, - INSIGHTS_MPI_IO_BLOCKING_WRITE_USAGE, - INSIGHTS_MPI_IO_AGGREGATORS_INTRA, - INSIGHTS_MPI_IO_AGGREGATORS_INTER, - INSIGHTS_MPI_IO_AGGREGATORS_OK - ] - if codes: - issues.extend(codes) - detected_issues = dict.fromkeys(issues, False) - detected_issues['JOB'] = jobid +def export_svg(console, export_dir, filename): + if not args.export_svg: + return + + os.makedirs(export_dir, exist_ok=True) + filepath = os.path.join(export_dir, f"{filename}.svg") + + console.save_svg( + filepath, + title='Drishti', + theme=set_export_theme(), + clear=False + ) - for report in csv_report: - detected_issues[report] = True - with open(filename, 'w') as f: - w = csv.writer(f) - w.writerow(detected_issues.keys()) - w.writerow(detected_issues.values()) +def export_csv(export_dir, filename, jobid=None): + if not args.export_csv: + return + + issues = [ + 'JOB', + INSIGHTS_STDIO_HIGH_USAGE, + INSIGHTS_POSIX_WRITE_COUNT_INTENSIVE, + INSIGHTS_POSIX_READ_COUNT_INTENSIVE, + INSIGHTS_POSIX_WRITE_SIZE_INTENSIVE, + INSIGHTS_POSIX_READ_SIZE_INTENSIVE, + INSIGHTS_POSIX_HIGH_SMALL_READ_REQUESTS_USAGE, + INSIGHTS_POSIX_HIGH_SMALL_WRITE_REQUESTS_USAGE, + INSIGHTS_POSIX_HIGH_MISALIGNED_MEMORY_USAGE, + INSIGHTS_POSIX_HIGH_MISALIGNED_FILE_USAGE, + INSIGHTS_POSIX_REDUNDANT_READ_USAGE, + INSIGHTS_POSIX_REDUNDANT_WRITE_USAGE, + INSIGHTS_POSIX_HIGH_RANDOM_READ_USAGE, + INSIGHTS_POSIX_HIGH_SEQUENTIAL_READ_USAGE, + INSIGHTS_POSIX_HIGH_RANDOM_WRITE_USAGE, + INSIGHTS_POSIX_HIGH_SEQUENTIAL_WRITE_USAGE, + INSIGHTS_POSIX_HIGH_SMALL_READ_REQUESTS_SHARED_FILE_USAGE, + INSIGHTS_POSIX_HIGH_SMALL_WRITE_REQUESTS_SHARED_FILE_USAGE, + INSIGHTS_POSIX_HIGH_METADATA_TIME, + INSIGHTS_POSIX_SIZE_IMBALANCE, + INSIGHTS_POSIX_TIME_IMBALANCE, + INSIGHTS_POSIX_INDIVIDUAL_WRITE_SIZE_IMBALANCE, + INSIGHTS_POSIX_INDIVIDUAL_READ_SIZE_IMBALANCE, + INSIGHTS_MPI_IO_NO_USAGE, + INSIGHTS_MPI_IO_NO_COLLECTIVE_READ_USAGE, + INSIGHTS_MPI_IO_NO_COLLECTIVE_WRITE_USAGE, + INSIGHTS_MPI_IO_COLLECTIVE_READ_USAGE, + INSIGHTS_MPI_IO_COLLECTIVE_WRITE_USAGE, + INSIGHTS_MPI_IO_BLOCKING_READ_USAGE, + INSIGHTS_MPI_IO_BLOCKING_WRITE_USAGE, + INSIGHTS_MPI_IO_AGGREGATORS_INTRA, + INSIGHTS_MPI_IO_AGGREGATORS_INTER, + INSIGHTS_MPI_IO_AGGREGATORS_OK + ] + if codes: + issues.extend(codes) + + detected_issues = dict.fromkeys(issues, False) + detected_issues['JOB'] = jobid + + for report in csv_report: + detected_issues[report] = True + + # ensure dir exists + os.makedirs(export_dir, exist_ok=True) + filepath = os.path.join(export_dir, f"{filename}.csv") + + print(f"DEBUG: export_dir: {export_dir}") + print(f"DEBUG: filename: {filename}") + print(f"DEBUG: filepath: {filepath}") + + with open(filepath, 'w') as f: + w = csv.writer(f) + w.writerow(detected_issues.keys()) + w.writerow(detected_issues.values()) diff --git a/drishti/includes/parser.py b/drishti/includes/parser.py index 8659520..afa4247 100644 --- a/drishti/includes/parser.py +++ b/drishti/includes/parser.py @@ -96,6 +96,13 @@ help='Export a CSV with the code of all issues that were triggered' ) +parser.add_argument( + '--export_dir', + default="", + dest='export_dir', + help='Specify the directory prefix for the output files (if any)' +) + parser.add_argument( '--json', default=False, @@ -119,3 +126,7 @@ ) args = parser.parse_args() + +print(f"DEBUG: log_path: {args.log_path}") +print(f"DEBUG: export_path: {args.export_dir}") +print(f"DEBUG: export_csv: {args.export_csv}") \ No newline at end of file From a0d5e12b9b2dd7c72fa0b7a4b7ca7d55d20436d6 Mon Sep 17 00:00:00 2001 From: Joel Tony Date: Fri, 7 Jun 2024 19:39:52 +0530 Subject: [PATCH 02/11] format: Remove debug statements --- drishti/handlers/handle_darshan.py | 4 +--- drishti/includes/module.py | 19 +++++-------------- drishti/includes/parser.py | 4 ---- 3 files changed, 6 insertions(+), 21 deletions(-) diff --git a/drishti/handlers/handle_darshan.py b/drishti/handlers/handle_darshan.py index 1270d7c..24c0519 100644 --- a/drishti/handlers/handle_darshan.py +++ b/drishti/handlers/handle_darshan.py @@ -752,12 +752,10 @@ def handler(): display_thresholds(console) display_footer(console, insights_start_time, insights_end_time) + # Export to HTML, SVG, and CSV input_filename = os.path.basename(args.log_path).replace('.darshan', '') out_dir = args.export_dir if args.export_dir != "" else os.getcwd() - print(f"DEBUG: outfile_name: {input_filename}") - export_html(console, out_dir, input_filename) export_svg(console, out_dir, input_filename) - export_csv(out_dir, input_filename, job['job']['jobid']) diff --git a/drishti/includes/module.py b/drishti/includes/module.py index 0e69430..f6f9fcf 100644 --- a/drishti/includes/module.py +++ b/drishti/includes/module.py @@ -1823,15 +1823,12 @@ def display_footer(console, insights_start_time, insights_end_time): ) ) -def export_html(console, export_dir, filename): - ''' - ''' +def export_html(console, export_dir, filename): if not args.export_html: - print("DEBUG: export_html() - return") return - os.makedirs(export_dir, exist_ok=True) + os.makedirs(export_dir, exist_ok=True) # Ensure export directory exists filepath = os.path.join(export_dir, f"{filename}.html") console.save_html( @@ -1840,14 +1837,12 @@ def export_html(console, export_dir, filename): clear=False ) - print("DEBUG: END export_html()") - def export_svg(console, export_dir, filename): if not args.export_svg: return - os.makedirs(export_dir, exist_ok=True) + os.makedirs(export_dir, exist_ok=True) # Ensure export directory exists filepath = os.path.join(export_dir, f"{filename}.svg") console.save_svg( @@ -1906,14 +1901,10 @@ def export_csv(export_dir, filename, jobid=None): for report in csv_report: detected_issues[report] = True - # ensure dir exists - os.makedirs(export_dir, exist_ok=True) + + os.makedirs(export_dir, exist_ok=True) # Ensure export directory exists filepath = os.path.join(export_dir, f"{filename}.csv") - print(f"DEBUG: export_dir: {export_dir}") - print(f"DEBUG: filename: {filename}") - print(f"DEBUG: filepath: {filepath}") - with open(filepath, 'w') as f: w = csv.writer(f) w.writerow(detected_issues.keys()) diff --git a/drishti/includes/parser.py b/drishti/includes/parser.py index afa4247..28dcd63 100644 --- a/drishti/includes/parser.py +++ b/drishti/includes/parser.py @@ -126,7 +126,3 @@ ) args = parser.parse_args() - -print(f"DEBUG: log_path: {args.log_path}") -print(f"DEBUG: export_path: {args.export_dir}") -print(f"DEBUG: export_csv: {args.export_csv}") \ No newline at end of file From a5c0d13690786d67459d8439994dd10369414f6d Mon Sep 17 00:00:00 2001 From: Joel Tony Date: Tue, 18 Jun 2024 19:25:51 +0530 Subject: [PATCH 03/11] Add export_dir support for recorder --- drishti/handlers/handle_recorder.py | 41 ++++++++++++++++++----------- 1 file changed, 26 insertions(+), 15 deletions(-) diff --git a/drishti/handlers/handle_recorder.py b/drishti/handlers/handle_recorder.py index 34c4790..e78bd1f 100644 --- a/drishti/handlers/handle_recorder.py +++ b/drishti/handlers/handle_recorder.py @@ -2,9 +2,11 @@ import os import time + import pandas as pd from recorder_utils import RecorderReader from recorder_utils.build_offset_intervals import build_offset_intervals + from drishti.includes.module import * @@ -577,23 +579,32 @@ def process_helper(file_map, df_intervals, df_posix_records, fid=None): display_thresholds(console) display_footer(console, insights_start_time, insights_end_time) - if args.split_files: - filename = '{}.{}.html'.format(args.log_path, fid) - else: - filename = '{}.html'.format(args.log_path) + # if args.split_files: + # filename = '{}.{}.html'.format(args.log_path, fid) + # else: + # filename = '{}.html'.format(args.log_path) - export_html(console, filename) + # export_html(console, filename) - if args.split_files: - filename = '{}.{}.svg'.format(args.log_path, fid) - else: - filename = '{}.svg'.format(args.log_path) + # if args.split_files: + # filename = '{}.{}.svg'.format(args.log_path, fid) + # else: + # filename = '{}.svg'.format(args.log_path) - export_svg(console, filename) + # export_svg(console, filename) - if args.split_files: - filename = '{}.{}.summary.csv'.format(args.log_path, fid) - else: - filename = '{}-summary.csv'.format(args.log_path) - export_csv(filename) + # if args.split_files: + # filename = '{}.{}.summary.csv'.format(args.log_path, fid) + # else: + # filename = '{}-summary.csv'.format(args.log_path) + # export_csv(filename) + + # Export to HTML, SVG, and CSV + input_filename = os.path.basename(os.path.dirname(args.log_path)) + input_filename = f"{input_filename}.{fid}" if args.split_files else input_filename # Append fid if split_files is enabled + + out_dir = args.export_dir if args.export_dir != "" else os.getcwd() + export_html(console, out_dir, input_filename) + export_svg(console, out_dir, input_filename) + export_csv(out_dir, input_filename, job['job']['jobid']) From 6dd5f0b5b4598ca266e9f3ed3fe6b55affd43114 Mon Sep 17 00:00:00 2001 From: Joel Tony Date: Tue, 18 Jun 2024 19:28:31 +0530 Subject: [PATCH 04/11] chore: Remove commented out code for exporting files in handle_recorder.py --- drishti/handlers/handle_recorder.py | 21 --------------------- 1 file changed, 21 deletions(-) diff --git a/drishti/handlers/handle_recorder.py b/drishti/handlers/handle_recorder.py index e78bd1f..01f4de8 100644 --- a/drishti/handlers/handle_recorder.py +++ b/drishti/handlers/handle_recorder.py @@ -579,30 +579,9 @@ def process_helper(file_map, df_intervals, df_posix_records, fid=None): display_thresholds(console) display_footer(console, insights_start_time, insights_end_time) - # if args.split_files: - # filename = '{}.{}.html'.format(args.log_path, fid) - # else: - # filename = '{}.html'.format(args.log_path) - - # export_html(console, filename) - - # if args.split_files: - # filename = '{}.{}.svg'.format(args.log_path, fid) - # else: - # filename = '{}.svg'.format(args.log_path) - - # export_svg(console, filename) - - # if args.split_files: - # filename = '{}.{}.summary.csv'.format(args.log_path, fid) - # else: - # filename = '{}-summary.csv'.format(args.log_path) - # export_csv(filename) - # Export to HTML, SVG, and CSV input_filename = os.path.basename(os.path.dirname(args.log_path)) input_filename = f"{input_filename}.{fid}" if args.split_files else input_filename # Append fid if split_files is enabled - out_dir = args.export_dir if args.export_dir != "" else os.getcwd() export_html(console, out_dir, input_filename) From 37e69ec130e42f880f19be7fd0f1a3e98296643d Mon Sep 17 00:00:00 2001 From: Joel Tony Date: Wed, 19 Jun 2024 10:32:32 +0530 Subject: [PATCH 05/11] feat: Update export file name to include "-summary" --- drishti/includes/module.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drishti/includes/module.py b/drishti/includes/module.py index f6f9fcf..ae9c0e2 100644 --- a/drishti/includes/module.py +++ b/drishti/includes/module.py @@ -1,11 +1,15 @@ #!/usr/bin/env python3 -import datetime import csv +import datetime import time + import pandas as pd from rich import box from rich.syntax import Syntax + +from rich.syntax import Syntax + from drishti.includes.config import * ''' @@ -1903,7 +1907,7 @@ def export_csv(export_dir, filename, jobid=None): os.makedirs(export_dir, exist_ok=True) # Ensure export directory exists - filepath = os.path.join(export_dir, f"{filename}.csv") + filepath = os.path.join(export_dir, f"{filename}-summary.csv") with open(filepath, 'w') as f: w = csv.writer(f) From 46b0c7fdf0cf8386853b5709b2477512c880364b Mon Sep 17 00:00:00 2001 From: Joel Tony Date: Wed, 19 Jun 2024 10:32:53 +0530 Subject: [PATCH 06/11] fix: Update export_csv function call in handle_recorder.py --- drishti/handlers/handle_recorder.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drishti/handlers/handle_recorder.py b/drishti/handlers/handle_recorder.py index 01f4de8..5a55267 100644 --- a/drishti/handlers/handle_recorder.py +++ b/drishti/handlers/handle_recorder.py @@ -586,4 +586,4 @@ def process_helper(file_map, df_intervals, df_posix_records, fid=None): export_html(console, out_dir, input_filename) export_svg(console, out_dir, input_filename) - export_csv(out_dir, input_filename, job['job']['jobid']) + export_csv(out_dir, input_filename) From ee7fcedf76c426c7ba5020a57da589088693b019 Mon Sep 17 00:00:00 2001 From: Joel Tony Date: Wed, 19 Jun 2024 10:33:06 +0530 Subject: [PATCH 07/11] fix: Update darshan dependency to version 3.4.4.0 or higher --- setup.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index 3e75113..a93a8ce 100644 --- a/setup.py +++ b/setup.py @@ -1,4 +1,4 @@ -from setuptools import setup, find_packages +from setuptools import find_packages, setup with open("README.md", "r") as f: long_description = f.read() @@ -19,7 +19,7 @@ install_requires=[ 'argparse', 'pandas', - 'darshan==3.4.4.0', + 'darshan>=3.4.4.0', 'rich==12.5.1', 'recorder-utils', ], From 4eec3bc877e7506e00722767e34bec6be0480a56 Mon Sep 17 00:00:00 2001 From: Joel Tony Date: Wed, 19 Jun 2024 10:33:06 +0530 Subject: [PATCH 08/11] fix: Update darshan dependency to version 3.4.4.0 or higher --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 65461cb..5020329 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,5 @@ argparse -darshan==3.4.4.0 +darshan>=3.4.4.0 pandas rich==12.5.1 recorder-utils From 3f0227b541339be849cf331d91037d45822b8bb6 Mon Sep 17 00:00:00 2001 From: Joel Tony Date: Wed, 19 Jun 2024 12:31:05 +0530 Subject: [PATCH 09/11] fmt: Clean up split_files case --- drishti/handlers/handle_recorder.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drishti/handlers/handle_recorder.py b/drishti/handlers/handle_recorder.py index 5a55267..0084c84 100644 --- a/drishti/handlers/handle_recorder.py +++ b/drishti/handlers/handle_recorder.py @@ -581,7 +581,8 @@ def process_helper(file_map, df_intervals, df_posix_records, fid=None): # Export to HTML, SVG, and CSV input_filename = os.path.basename(os.path.dirname(args.log_path)) - input_filename = f"{input_filename}.{fid}" if args.split_files else input_filename # Append fid if split_files is enabled + if args.split_files: + input_filename = f"{input_filename}.{fid}" out_dir = args.export_dir if args.export_dir != "" else os.getcwd() export_html(console, out_dir, input_filename) From 42f1bf32e287177d99f37f715c98d47a4a9a90ad Mon Sep 17 00:00:00 2001 From: Joel Tony Date: Wed, 19 Jun 2024 12:33:19 +0530 Subject: [PATCH 10/11] fmt: import statements --- drishti/includes/module.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/drishti/includes/module.py b/drishti/includes/module.py index ae9c0e2..f6f9fcf 100644 --- a/drishti/includes/module.py +++ b/drishti/includes/module.py @@ -1,15 +1,11 @@ #!/usr/bin/env python3 -import csv import datetime +import csv import time - import pandas as pd from rich import box from rich.syntax import Syntax - -from rich.syntax import Syntax - from drishti.includes.config import * ''' @@ -1907,7 +1903,7 @@ def export_csv(export_dir, filename, jobid=None): os.makedirs(export_dir, exist_ok=True) # Ensure export directory exists - filepath = os.path.join(export_dir, f"{filename}-summary.csv") + filepath = os.path.join(export_dir, f"{filename}.csv") with open(filepath, 'w') as f: w = csv.writer(f) From 4e154e1e0937f0dd4185bdee5ce75c6617fccb7f Mon Sep 17 00:00:00 2001 From: Joel Tony Date: Wed, 19 Jun 2024 15:01:59 +0530 Subject: [PATCH 11/11] fmt: Rename `input_filename` to `trace_name` --- drishti/handlers/handle_darshan.py | 8 ++++---- drishti/handlers/handle_recorder.py | 10 +++++----- drishti/includes/module.py | 12 ++++++------ 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/drishti/handlers/handle_darshan.py b/drishti/handlers/handle_darshan.py index 24c0519..ea690f3 100644 --- a/drishti/handlers/handle_darshan.py +++ b/drishti/handlers/handle_darshan.py @@ -753,9 +753,9 @@ def handler(): display_footer(console, insights_start_time, insights_end_time) # Export to HTML, SVG, and CSV - input_filename = os.path.basename(args.log_path).replace('.darshan', '') + trace_name = os.path.basename(args.log_path).replace('.darshan', '') out_dir = args.export_dir if args.export_dir != "" else os.getcwd() - export_html(console, out_dir, input_filename) - export_svg(console, out_dir, input_filename) - export_csv(out_dir, input_filename, job['job']['jobid']) + export_html(console, out_dir, trace_name) + export_svg(console, out_dir, trace_name) + export_csv(out_dir, trace_name, job['job']['jobid']) diff --git a/drishti/handlers/handle_recorder.py b/drishti/handlers/handle_recorder.py index 0084c84..afccfce 100644 --- a/drishti/handlers/handle_recorder.py +++ b/drishti/handlers/handle_recorder.py @@ -580,11 +580,11 @@ def process_helper(file_map, df_intervals, df_posix_records, fid=None): display_footer(console, insights_start_time, insights_end_time) # Export to HTML, SVG, and CSV - input_filename = os.path.basename(os.path.dirname(args.log_path)) + trace_name = os.path.basename(os.path.dirname(args.log_path)) if args.split_files: - input_filename = f"{input_filename}.{fid}" + trace_name = f"{trace_name}.{fid}" out_dir = args.export_dir if args.export_dir != "" else os.getcwd() - export_html(console, out_dir, input_filename) - export_svg(console, out_dir, input_filename) - export_csv(out_dir, input_filename) + export_html(console, out_dir, trace_name) + export_svg(console, out_dir, trace_name) + export_csv(out_dir, trace_name) diff --git a/drishti/includes/module.py b/drishti/includes/module.py index f6f9fcf..9c2df16 100644 --- a/drishti/includes/module.py +++ b/drishti/includes/module.py @@ -1824,12 +1824,12 @@ def display_footer(console, insights_start_time, insights_end_time): ) -def export_html(console, export_dir, filename): +def export_html(console, export_dir, trace_name): if not args.export_html: return os.makedirs(export_dir, exist_ok=True) # Ensure export directory exists - filepath = os.path.join(export_dir, f"{filename}.html") + filepath = os.path.join(export_dir, f"{trace_name}.html") console.save_html( filepath, @@ -1838,12 +1838,12 @@ def export_html(console, export_dir, filename): ) -def export_svg(console, export_dir, filename): +def export_svg(console, export_dir, trace_name): if not args.export_svg: return os.makedirs(export_dir, exist_ok=True) # Ensure export directory exists - filepath = os.path.join(export_dir, f"{filename}.svg") + filepath = os.path.join(export_dir, f"{trace_name}.svg") console.save_svg( filepath, @@ -1853,7 +1853,7 @@ def export_svg(console, export_dir, filename): ) -def export_csv(export_dir, filename, jobid=None): +def export_csv(export_dir, trace_name, jobid=None): if not args.export_csv: return @@ -1903,7 +1903,7 @@ def export_csv(export_dir, filename, jobid=None): os.makedirs(export_dir, exist_ok=True) # Ensure export directory exists - filepath = os.path.join(export_dir, f"{filename}.csv") + filepath = os.path.join(export_dir, f"{trace_name}.csv") with open(filepath, 'w') as f: w = csv.writer(f)