|
1 | 1 | import argparse |
2 | 2 | import os |
3 | | -from src.data_parse import DataParser |
4 | 3 | from pathlib import Path |
5 | | - |
| 4 | +from src.data_parse import DataParser |
6 | 5 |
|
7 | 6 | if __name__ == '__main__': |
8 | | - |
9 | 7 | 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)') |
11 | 9 | parser.add_argument('--subgraphs-only', action='store_true', help='had previously parsed the debug file, only generate subgraphs') |
12 | 10 | args = parser.parse_args() |
13 | 11 |
|
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] |
16 | 14 |
|
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) |
19 | 22 |
|
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}") |
25 | 26 |
|
| 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