Spaces:
Running on Zero
Running on Zero
File size: 1,176 Bytes
526bfa8 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | """CLI for deterministic single scenarios or the local regression suite."""
import argparse
import json
from pathlib import Path
from .simulator import compare, list_scenarios, load_manifest_text, load_scenario, run_suite
def main():
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument('--scenario', choices=list_scenarios(), default='stale_flight')
parser.add_argument('--suite', action='store_true')
parser.add_argument('--manifest', type=Path)
parser.add_argument('--no-recovery', action='store_true')
parser.add_argument('--output', type=Path)
args = parser.parse_args()
text = args.manifest.read_text() if args.manifest else load_manifest_text()
result = (run_suite(text, not args.no_recovery) if args.suite else
compare(load_scenario(args.scenario), text, not args.no_recovery))
output = json.dumps(result, indent=2, ensure_ascii=False, allow_nan=False) + '\n'
if args.output:
args.output.parent.mkdir(parents=True, exist_ok=True)
args.output.write_text(output)
print(f'Saved {args.output}')
else:
print(output)
if __name__ == '__main__':
main()
|