Skip to content

Commit 1181e23

Browse files
committed
parse list
1 parent 5af684b commit 1181e23

File tree

1 file changed

+22
-13
lines changed

1 file changed

+22
-13
lines changed

generate_data.py

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,34 @@
11
import argparse
22
import os
3-
from src.data_parse import DataParser
43
from pathlib import Path
5-
4+
from src.data_parse import DataParser
65

76
if __name__ == '__main__':
8-
97
parser = argparse.ArgumentParser()
10-
parser.add_argument('runtime_template', type=str, help='list of log directories')
8+
parser.add_argument('runtime_templates', type=str, nargs='+', help='list of log directories (e.g., log1 log2 log3)')
119
parser.add_argument('--subgraphs-only', action='store_true', help='had previously parsed the debug file, only generate subgraphs')
1210
args = parser.parse_args()
1311

14-
runtime_template = Path(args.runtime_template).name
15-
runtime_template = os.path.join(os.getcwd(), 'logs', runtime_template)
12+
root_dir = os.path.join(os.getcwd(), 'logs')
13+
full_paths = [os.path.join(root_dir, Path(rt).name) for rt in args.runtime_templates]
1614

17-
print(f"=== Generating data for {runtime_template}")
18-
data_parser = DataParser(runtime_template)
15+
# verify all paths exist
16+
missing = [p for p in full_paths if not os.path.exists(p)]
17+
if missing:
18+
print("❌ The following log directories do not exist:")
19+
for m in missing:
20+
print(f" - {m}")
21+
exit(1)
1922

20-
if args.subgraphs_only:
21-
data_parser.generate_subgraphs()
22-
else:
23-
data_parser.parse_logs()
24-
data_parser.generate_subgraphs()
23+
print("✅ The following log directories will be processed:")
24+
for path in full_paths:
25+
print(f" - {path}")
2526

27+
for runtime_template in full_paths:
28+
print(f"\n=== Start parsing: {runtime_template}")
29+
data_parser = DataParser(runtime_template)
30+
if args.subgraphs_only:
31+
data_parser.generate_subgraphs()
32+
else:
33+
data_parser.parse_logs()
34+
data_parser.generate_subgraphs()

0 commit comments

Comments
 (0)