Skip to content

Commit cfee7b6

Browse files
bertiethorpeMaxBed4d
authored andcommitted
Update extract_logs.py
1 parent 2932a9d commit cfee7b6

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

dev/extract_logs.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
1+
2+
3+
14
import csv
25
import re
36
import os
7+
import sys
48

59
def convert_time_to_seconds(time_str):
610
h, m, s = time_str.split(':')
@@ -58,8 +62,11 @@ def extract_log_info_and_generate_csv(log_file_path, output_csv_path, target_dir
5862

5963
print(f"Data extracted, sorted, and saved to {output_csv_path}")
6064

61-
log_file_path = './RL9-ofed-fatimage-177.txt' # Input workflow log name
62-
output_csv_path = 'RL9-ofed-fatimage-177.csv' # Output CSV name
65+
if len(sys.argv) != 2:
66+
print("Path to workflow log plain text file should be provided as the only arg to this script")
67+
sys.exit(1)
68+
log_file_path = sys.argv[1] # Input workflow log name
69+
output_csv_path = log_file_path.replace('.txt.', '.csv') # Output CSV name
6370
target_directory = '/ansible/' # Shared directory for task path
6471

6572
extract_log_info_and_generate_csv(log_file_path, output_csv_path, target_directory)

0 commit comments

Comments
 (0)