- renamed _config_values_main to training_config.py and renamed the ConfigValuesMain class to TrainingConfig. Moved training_config.py to src/primaite/config/training_config.py - Renamed all training config yaml file keys to make creating an instance of TrainingConfig easier. Moved action_type and num_steps over to the training config. - Decoupled the training config and lay down config. - Refactored main.py so that it can be ran from CLI and can take a training config path and a lay down config path. - refactored all outputs so that they save to the session dir. - Added some necessary setup scripts that handle creating app dirs, fronting example config files to the user, fronting demo notebooks to the user, performing clean-up in between installations etc. - Added functions that attempt to retrieve the file path of users example config files that have been fronted by the primaite setup. - Added logging config and a getLogger function in the top-level init. - Refactored all logs entries logged to use a logger using the primaite logging config. - Added basic typer CLI for doing things like setup, viewing logs, viewing primaite version, running a basic session. - Updated test to use new features and config structures. - Began updating docs. More to do here.
37 lines
1.2 KiB
Python
37 lines
1.2 KiB
Python
# Crown Copyright (C) Dstl 2022. DEFCON 703. Shared in confidence.
|
|
import yaml
|
|
|
|
from primaite.config import training_config
|
|
from tests import TEST_CONFIG_ROOT
|
|
|
|
|
|
def test_legacy_lay_down_config_yaml_conversion():
|
|
"""Tests the conversion of legacy lay down config files."""
|
|
legacy_path = TEST_CONFIG_ROOT / "legacy" / "legacy_training_config.yaml"
|
|
new_path = TEST_CONFIG_ROOT / "legacy" / "new_training_config.yaml"
|
|
|
|
with open(legacy_path, "r") as file:
|
|
legacy_dict = yaml.safe_load(file)
|
|
|
|
with open(new_path, "r") as file:
|
|
new_dict = yaml.safe_load(file)
|
|
|
|
converted_dict = training_config.convert_legacy_training_config_dict(
|
|
legacy_dict)
|
|
|
|
assert converted_dict == new_dict
|
|
|
|
|
|
def test_create_config_values_main_from_file():
|
|
"""Tests creating an instance of TrainingConfig from file."""
|
|
new_path = TEST_CONFIG_ROOT / "legacy" / "new_training_config.yaml"
|
|
|
|
training_config.load(new_path)
|
|
|
|
|
|
def test_create_config_values_main_from_legacy_file():
|
|
"""Tests creating an instance of TrainingConfig from legacy file."""
|
|
new_path = TEST_CONFIG_ROOT / "legacy" / "legacy_training_config.yaml"
|
|
|
|
training_config.load(new_path, legacy_file=True)
|