Refactor structure to do a single call

This commit is contained in:
Alberto Soutullo Rendo 2022-11-18 10:47:29 +01:00
parent 820289a962
commit 28fc7aea60
27 changed files with 30077 additions and 55 deletions

View File

@ -1,38 +0,0 @@
{
"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
}

View File

@ -1,4 +0,0 @@
# Workaround while docker is not set up
binary_path = "C:/Users/Alberto/Desktop/Status/consensus-prototypes/target/release-opt/consensus-simulations.exe"
schema_path = "../Utilities/Files/Schemas/configuration_schema.json"

0
Plotter/__init__.py → src/__init__.py Normal file → Executable file
View File

14
src/main.py Executable file
View File

@ -0,0 +1,14 @@
# Python Imports
import typer
def main(
run_type: str = typer.Option(..., "--run", "-r"),
):
# Calls depending on json config
pass
if __name__ == '__main__':
print("test")
# typer.run(main)

View File

@ -0,0 +1,43 @@
{
"simulation": {
"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
},
"plotting": {
"test": "test"
}
}

View File

@ -2,17 +2,18 @@
import typer
# Project Imports
from Utilities.Files.Json.simulation_config_parser import SimulationConfigParser
from src.utilities.files.json.simulation_config_parser import SimulationConfigParser
from runner import run_simulation
def main(
# todo put in output format possible names (-f --output-format)
output_format: str = typer.Option(..., "--output-format", "-f"),
input_settings: str = typer.Option(..., "--input-settings", "-i"),
# input_settings: str = typer.Option(..., "--input-settings", "-i"),
output_file: str = typer.Option(..., "--output-file", "-o")
):
# Check config file
input_settings = "/app/config_example.json"
parser = SimulationConfigParser(input_settings)
parser.read_content()
# Calls simulation with configuration

View File

@ -2,8 +2,8 @@
import os
# Project Imports
from Utilities.env_variables import binary_path
from src.utilities.env_variables import binary_name
def run_simulation(output_format, input_settings, output_file):
os.system(binary_path + " -f " + output_format + " -i " + input_settings + " -o " + output_file)
os.system(binary_name + " -f " + output_format + " -i " + input_settings + " -o " + output_file)

30001
src/simulation_runner/test.csv Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,5 @@
# Workaround while docker is not set up
# binary_path = "wsl /mnt/d/Projects/status/Rust/consensus-research/target/release-opt/snow-family"
binary_name = "snow-family"
schema_path = "../utilities/files/schemas/snow_family_configuration_schema.json"

View File

@ -1,5 +1,5 @@
from Utilities import env_variables
from Utilities.Files.Json.json_utils import read_json, validate_json
from src.utilities import env_variables
from src.utilities.files.json.json_utils import read_json, validate_json
class SimulationConfigParser:

View File

@ -19,7 +19,7 @@
},
"required": ["quorum_size", "sample_size", "decision_threshold"]
},
"glacier": {
"claro": {
"type": "object",
"properties": {
"evidence_alpha": {"type": "number"},

View File

@ -2,9 +2,9 @@
import os.path
# Project Imports
from Utilities.Files.SimulationDataTypes.JsonDataSimulationHandler import JsonDataSimulationHandler
from Utilities.Files.SimulationDataTypes.CsvDataSimulationHandler import CsvDataSimulationHandler
from Utilities.Files.SimulationDataTypes.ParquetSimulationDataHandler import ParquetDataSimulationHandler
from src.utilities.files.simulation_data_types.json_data_simulation_handler import JsonDataSimulationHandler
from src.utilities.files.simulation_data_types.csv_data_simulation_handler import CsvDataSimulationHandler
from src.utilities.files.simulation_data_types.parquet_simulation_data_handler import ParquetDataSimulationHandler
handlers = {'.csv': CsvDataSimulationHandler,
'.json': JsonDataSimulationHandler,

View File

@ -1,4 +1,4 @@
from Utilities.Files.SimulationDataTypes.BaseDataSimulationHandler import BaseDataSimulationHandler
from src.utilities.files.simulation_data_types.base_data_simulation_handler import BaseDataSimulationHandler
class CsvDataSimulationHandler(BaseDataSimulationHandler):

View File

@ -1,4 +1,4 @@
from Utilities.Files.SimulationDataTypes.BaseDataSimulationHandler import BaseDataSimulationHandler
from src.utilities.files.simulation_data_types.base_data_simulation_handler import BaseDataSimulationHandler
class JsonDataSimulationHandler(BaseDataSimulationHandler):

View File

@ -1,4 +1,4 @@
from Utilities.Files.SimulationDataTypes.BaseDataSimulationHandler import BaseDataSimulationHandler
from src.utilities.files.simulation_data_types.base_data_simulation_handler import BaseDataSimulationHandler
class ParquetDataSimulationHandler(BaseDataSimulationHandler):