Coverage for sparkle/configurator/configurator_cli.py: 0%
17 statements
« prev ^ index » next coverage.py v7.6.10, created at 2025-01-07 15:22 +0000
« prev ^ index » next coverage.py v7.6.10, created at 2025-01-07 15:22 +0000
1#!/usr/bin/env python3
2"""Configurator CLI wrapper class to standardise I/O of Configurators."""
3import sys
4import subprocess
5from pathlib import Path
6import implementations
8if __name__ == "__main__":
9 args = sys.argv
10 configurator_name = args[1]
11 output_source = Path(args[2])
12 output_target = Path(args[3])
13 scenario = Path(args[4])
14 run_id = int(args[5])
15 configurator_call = args[6:]
16 # 1. Resolve for which Configurator we are standardising
17 configurator = implementations.resolve_configurator(configurator_name)
18 scenario = configurator.scenario_class().from_file(scenario)
19 # 2. Execute the call, output is automatically piped to the caller's set output
20 subprocess.run(configurator_call)
21 # 3. Have the configurator implementation organise the output, standardised
22 configurator.organise_output(output_source=output_source,
23 output_target=output_target,
24 scenario=scenario,
25 run_id=run_id)
26 print(f"Organising done! See {output_target} for results.")