Created main.py file for simulation runner and added json example

This commit is contained in:
Alberto 2022-09-22 17:57:07 +02:00
parent e38cef5b52
commit fb2415ea7a
2 changed files with 63 additions and 0 deletions

View File

@ -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
}

25
SimulationRunner/main.py Normal file
View File

@ -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