From a5c0d13690786d67459d8439994dd10369414f6d Mon Sep 17 00:00:00 2001 From: Joel Tony Date: Tue, 18 Jun 2024 19:25:51 +0530 Subject: [PATCH] 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'])