Give the UC2 config load function a meaningful name

This commit is contained in:
Marek Wolan
2024-03-04 19:43:51 +00:00
parent 1e8dfa40cf
commit a222a8c58f
11 changed files with 21 additions and 21 deletions

View File

@@ -127,10 +127,10 @@ def session(
:param config: The path to the config file. Optional, if None, the example config will be used.
:type config: Optional[str]
"""
from primaite.config.load import example_config_path
from primaite.config.load import data_manipulation_config_path
from primaite.main import run
if not config:
config = example_config_path()
config = data_manipulation_config_path()
print(config)
run(config_path=config, agent_load_path=agent_load_file)

View File

@@ -30,7 +30,7 @@ def load(file_path: Union[str, Path]) -> Dict:
return config
def example_config_path() -> Path:
def data_manipulation_config_path() -> Path:
"""
Get the path to the example config.

View File

@@ -5,7 +5,7 @@ from pathlib import Path
from typing import Optional, Union
from primaite import getLogger
from primaite.config.load import example_config_path, load
from primaite.config.load import data_manipulation_config_path, load
from primaite.session.session import PrimaiteSession
# from primaite.primaite_session import PrimaiteSession
@@ -42,6 +42,6 @@ if __name__ == "__main__":
args = parser.parse_args()
if not args.config:
args.config = example_config_path()
args.config = data_manipulation_config_path()
run(args.config)

View File

@@ -371,7 +371,7 @@
"outputs": [],
"source": [
"# Imports\n",
"from primaite.config.load import example_config_path\n",
"from primaite.config.load import data_manipulation_config_path\n",
"from primaite.session.environment import PrimaiteGymEnv\n",
"from primaite.game.game import PrimaiteGame\n",
"import yaml\n",
@@ -394,7 +394,7 @@
"outputs": [],
"source": [
"# create the env\n",
"with open(example_config_path(), 'r') as f:\n",
"with open(data_manipulation_config_path(), 'r') as f:\n",
" cfg = yaml.safe_load(f)\n",
" # set success probability to 1.0 to avoid rerunning cells.\n",
" cfg['simulation']['network']['nodes'][8]['applications'][0]['options']['data_manipulation_p_of_success'] = 1.0\n",

View File

@@ -16,7 +16,7 @@
"source": [
"from primaite.game.game import PrimaiteGame\n",
"import yaml\n",
"from primaite.config.load import example_config_path\n",
"from primaite.config.load import data_manipulation_config_path\n",
"\n",
"from primaite.session.environment import PrimaiteRayEnv\n",
"from ray.rllib.algorithms import ppo\n",
@@ -26,7 +26,7 @@
"\n",
"# If you get an error saying this config file doesn't exist, you may need to run `primaite setup` in your command line\n",
"# to copy the files to your user data path.\n",
"with open(example_config_path(), 'r') as f:\n",
"with open(data_manipulation_config_path(), 'r') as f:\n",
" cfg = yaml.safe_load(f)\n",
"\n",
"ray.init(local_mode=True)\n"

View File

@@ -17,7 +17,7 @@
"metadata": {},
"outputs": [],
"source": [
"from primaite.config.load import example_config_path"
"from primaite.config.load import data_manipulation_config_path"
]
},
{
@@ -26,7 +26,7 @@
"metadata": {},
"outputs": [],
"source": [
"with open(example_config_path(), 'r') as f:\n",
"with open(data_manipulation_config_path(), 'r') as f:\n",
" cfg = yaml.safe_load(f)\n"
]
},