From fb2415ea7a378b34bf82a801593b00f9652f4d62 Mon Sep 17 00:00:00 2001 From: Alberto Date: Thu, 22 Sep 2022 17:57:07 +0200 Subject: [PATCH] Created main.py file for simulation runner and added json example --- SimulationRunner/config_example.json | 38 ++++++++++++++++++++++++++++ SimulationRunner/main.py | 25 ++++++++++++++++++ 2 files changed, 63 insertions(+) create mode 100644 SimulationRunner/config_example.json create mode 100644 SimulationRunner/main.py diff --git a/SimulationRunner/config_example.json b/SimulationRunner/config_example.json new file mode 100644 index 0000000..286e667 --- /dev/null +++ b/SimulationRunner/config_example.json @@ -0,0 +1,38 @@ +{ + "consensus_settings": { + "snow_ball": { + "quorum_size": 14, + "sample_size": 20, + "decision_threshold": 20 + } + }, + "distribution": { + "yes": 0.6, + "no": 0.4, + "none": 0.0 + }, + "byzantine_settings": { + "total_size": 10000, + "distribution": { + "honest": 1.0, + "infantile": 0.0, + "random": 0.0, + "omniscient": 0.0 + } + }, + "wards": [ + { + "time_to_finality": { + "ttf_threshold" : 1 + } + } + ], + "network_modifiers": [ + { + "random_drop": { + "drop_rate": 0.01 + } + } + ], + "seed" : 18042022 +} \ No newline at end of file diff --git a/SimulationRunner/main.py b/SimulationRunner/main.py new file mode 100644 index 0000000..091d86d --- /dev/null +++ b/SimulationRunner/main.py @@ -0,0 +1,25 @@ +# Python Imports +import typer + +# Project Imports +from Utilities.file_parser import ConfigurationFileParser + + +def main( + # todo put in output format possible names (-f --output-format) + output_format: str = typer.Argument("parquet"), + input_settings: str = typer.Option(..., "--input-settings", "-i"), + output_file: str = typer.Option(..., "--output-file", "-o") +): + # Check config file + parser = ConfigurationFileParser(input_settings) + config = parser.read_content() + # Calls simulation with configuration + + +if __name__ == '__main__': + typer.run(main) + + # Run simulation with arguments + + pass