#1647 - Added _PrimaitePaths class that manages all the primaite locations using PlayformDirs. This class now creates new primaite locations for each version of primaite.

- Rolled the _PrimaitePaths class out throughout the code base.
- Updated the docs to reference the new version paths.
- Updated the author from qinetiq to dstl
- Bumped version number to 2.0.0rc2
This commit is contained in:
Chris McCarthy
2023-07-21 14:00:50 +01:00
parent de8f847afd
commit 534c066170
19 changed files with 192 additions and 185 deletions

View File

@@ -19,8 +19,8 @@ sys.path.insert(0, os.path.abspath("../"))
# -- Project information -----------------------------------------------------
year = datetime.datetime.now().year
project = "PrimAITE"
copyright = f"Copyright (C) QinetiQ Training and Simulation Ltd 2021 - {year}"
author = "QinetiQ Training and Simulation Ltd"
copyright = f"Copyright (C) Defence Science and Technology Laboratory UK 2021 - {year}"
author = "Defence Science and Technology Laboratory UK"
# The short Major.Minor.Build version
with open("../src/primaite/VERSION", "r") as file:

View File

@@ -130,7 +130,7 @@ Finally, specify your agent in your training config.
.. code-block:: yaml
# ~/primaite/config/path/to/your/config_main.yaml
# ~/primaite/2.0.0rc2/config/path/to/your/config_main.yaml
# Training Config File

View File

@@ -41,12 +41,12 @@ Install PrimAITE
.. code-tab:: bash
:caption: Unix
mkdir ~/primaite
mkdir ~/primaite/2.0.0rc2
.. code-tab:: powershell
:caption: Windows (Powershell)
mkdir ~\primaite
mkdir ~\primaite\2.0.0rc2
2. Navigate to the primaite directory and create a new python virtual environment (venv)
@@ -55,13 +55,13 @@ Install PrimAITE
.. code-tab:: bash
:caption: Unix
cd ~/primaite
cd ~/primaite/2.0.0rc2
python3 -m venv .venv
.. code-tab:: powershell
:caption: Windows (Powershell)
cd ~\primaite
cd ~\primaite\2.0.0rc2
python3 -m venv .venv
attrib +h .venv /s /d # Hides the .venv directory

View File

@@ -77,5 +77,5 @@ Glossary
Gym
PrimAITE uses the Gym reinforcement learning framework API to create a training environment and interface with RL agents. Gym defines a common way of creating observations, actions, and rewards.
User data directory
PrimAITE supports upgrading software version while retaining user data. The user data directory is where configs, notebooks, and results are stored, this location is `~/primaite` on linux/darwin and `C:\Users\<username>\primaite` on Windows.
User app home
PrimAITE supports upgrading software version while retaining user data. The user data directory is where configs, notebooks, and results are stored, this location is `~/primaite<version>` on linux/darwin and `C:\Users\<username>\primaite\<version>` on Windows.

View File

@@ -31,7 +31,7 @@ v1.2 to v2.0 Migration guide
**3. Location of configs**
In version 1.2, training configs and laydown configs were all stored in the project repository under ``src/primaite/config``. Version 2.0.0 introduced user data directories, and now when you install and setup PrimAITE, config files are stored in your user data location. On Linux/OSX, this is stored in ``~/primaite/config``. On Windows, this is stored in ``C:\Users\<your username>\primaite\configs``. Upon first setup, the configs folder is populated with some default yaml files. It is recommended that you store all your custom configuration files here.
In version 1.2, training configs and laydown configs were all stored in the project repository under ``src/primaite/config``. Version 2.0.0 introduced user data directories, and now when you install and setup PrimAITE, config files are stored in your user data location. On Linux/OSX, this is stored in ``~/primaite/2.0.0rc2/config``. On Windows, this is stored in ``C:\Users\<your username>\primaite\configs``. Upon first setup, the configs folder is populated with some default yaml files. It is recommended that you store all your custom configuration files here.
**4. Contents of configs**

View File

@@ -20,14 +20,14 @@ Both the ``primaite session`` and :func:`primaite.main.run` take a training conf
.. code-tab:: bash
:caption: Unix CLI
cd ~/primaite
cd ~/primaite/2.0.0rc2
source ./.venv/bin/activate
primaite session --tc ./config/my_training_config.yaml --ldc ./config/my_lay_down_config.yaml
.. code-tab:: powershell
:caption: Powershell CLI
cd ~\primaite
cd ~\primaite\2.0.0rc2
.\.venv\Scripts\activate
primaite session --tc .\config\my_training_config.yaml --ldc .\config\my_lay_down_config.yaml
@@ -41,11 +41,11 @@ Both the ``primaite session`` and :func:`primaite.main.run` take a training conf
lay_down_config = <path to lay down config yaml file>
run(training_config, lay_down_config)
When a session is ran, a session output sub-directory is created in the users app sessions directory (``~/primaite/sessions``).
The sub-directory is formatted as such: ``~/primaite/sessions/<yyyy-mm-dd>/<yyyy-mm-dd>_<hh-mm-dd>/``
When a session is ran, a session output sub-directory is created in the users app sessions directory (``~/primaite/2.0.0rc2/sessions``).
The sub-directory is formatted as such: ``~/primaite/2.0.0rc2/sessions/<yyyy-mm-dd>/<yyyy-mm-dd>_<hh-mm-dd>/``
For example, when running a session at 17:30:00 on 31st January 2023, the session will output to:
``~/primaite/sessions/2023-01-31/2023-01-31_17-30-00/``.
``~/primaite/2.0.0rc2/sessions/2023-01-31/2023-01-31_17-30-00/``.
``primaite session`` can be ran in the terminal/command prompt without arguments. It will use the default configs in the directory ``primaite/config/example_config``.
@@ -110,43 +110,44 @@ For each training session, assuming the agent being trained implements the *save
~/
└── primaite/
└── sessions/
└── 2023-07-18/
└── 2023-07-18_11-06-04/
── evaluation/
├── all_transactions_2023-07-18_11-06-04.csv
│ ├── average_reward_per_episode_2023-07-18_11-06-04.csv
── average_reward_per_episode_2023-07-18_11-06-04.png
├── learning/
├── all_transactions_2023-07-18_11-06-04.csv
│ ├── average_reward_per_episode_2023-07-18_11-06-04.csv
│ ├── average_reward_per_episode_2023-07-18_11-06-04.png
│ ├── checkpoints/
── sb3ppo_10.zip
│ ├── SB3_PPO.zip
── tensorboard_logs/
── PPO_1/
└── events.out.tfevents.1689674765.METD-9PMRFB3.42960.0
├── PPO_2/
└── events.out.tfevents.1689674766.METD-9PMRFB3.42960.1
├── PPO_3/
└── events.out.tfevents.1689674766.METD-9PMRFB3.42960.2
├── PPO_4/
└── events.out.tfevents.1689674767.METD-9PMRFB3.42960.3
├── PPO_5/
└── events.out.tfevents.1689674767.METD-9PMRFB3.42960.4
├── PPO_6/
└── events.out.tfevents.1689674768.METD-9PMRFB3.42960.5
├── PPO_7/
└── events.out.tfevents.1689674768.METD-9PMRFB3.42960.6
├── PPO_8/
└── events.out.tfevents.1689674769.METD-9PMRFB3.42960.7
├── PPO_9/
└── events.out.tfevents.1689674770.METD-9PMRFB3.42960.8
│ └── PPO_10/
└── events.out.tfevents.1689674770.METD-9PMRFB3.42960.9
├── network_2023-07-18_11-06-04.png
└── session_metadata.json
└── 2.0.0rc2/
└── sessions/
└── 2023-07-18/
── 2023-07-18_11-06-04/
├── evaluation/
│ ├── all_transactions_2023-07-18_11-06-04.csv
── average_reward_per_episode_2023-07-18_11-06-04.csv
│ └── average_reward_per_episode_2023-07-18_11-06-04.png
├── learning/
│ ├── all_transactions_2023-07-18_11-06-04.csv
│ ├── average_reward_per_episode_2023-07-18_11-06-04.csv
│ ├── average_reward_per_episode_2023-07-18_11-06-04.png
── checkpoints/
│ │ └── sb3ppo_10.zip
── SB3_PPO.zip
── tensorboard_logs/
├── PPO_1/
│ └── events.out.tfevents.1689674765.METD-9PMRFB3.42960.0
├── PPO_2/
│ └── events.out.tfevents.1689674766.METD-9PMRFB3.42960.1
├── PPO_3/
│ └── events.out.tfevents.1689674766.METD-9PMRFB3.42960.2
├── PPO_4/
│ └── events.out.tfevents.1689674767.METD-9PMRFB3.42960.3
├── PPO_5/
│ └── events.out.tfevents.1689674767.METD-9PMRFB3.42960.4
├── PPO_6/
│ └── events.out.tfevents.1689674768.METD-9PMRFB3.42960.5
├── PPO_7/
│ └── events.out.tfevents.1689674768.METD-9PMRFB3.42960.6
├── PPO_8/
│ └── events.out.tfevents.1689674769.METD-9PMRFB3.42960.7
├── PPO_9/
└── events.out.tfevents.1689674770.METD-9PMRFB3.42960.8
└── PPO_10/
│ └── events.out.tfevents.1689674770.METD-9PMRFB3.42960.9
├── network_2023-07-18_11-06-04.png
└── session_metadata.json
Loading a session
-----------------
@@ -159,14 +160,14 @@ A previous session can be loaded by providing the **directory** of the previous
.. code-tab:: bash
:caption: Unix CLI
cd ~/primaite
cd ~/primaite/2.0.0rc2
source ./.venv/bin/activate
primaite session --load "path/to/session"
.. code-tab:: bash
:caption: Powershell CLI
cd ~\primaite
cd ~\primaite\2.0.0rc2
.\.venv\Scripts\activate
primaite session --load "path\to\session"