diff --git a/docs/source/primaite_session.rst b/docs/source/primaite_session.rst index b8895fc7..c081d0d9 100644 --- a/docs/source/primaite_session.rst +++ b/docs/source/primaite_session.rst @@ -47,6 +47,105 @@ The sub-directory is formatted as such: ``~/primaite/sessions//) When PrimAITE runs a loaded session, PrimAITE will output in the provided session directory - -Outputs -------- - -PrimAITE produces four types of outputs: - -* Session Metadata -* Results -* Diagrams -* Saved agents - - -**Session Metadata** - -PrimAITE creates a ``session_metadata.json`` file that contains the following metadata: - - * **uuid** - The UUID assigned to the session upon instantiation. - * **start_datetime** - The date & time the session started in iso format. - * **end_datetime** - The date & time the session ended in iso format. - * **total_episodes** - The total number of training episodes completed. - * **total_time_steps** - The total number of training time steps completed. - * **env** - * **training_config** - * **All training config items** - * **lay_down_config** - * **All lay down config items** - - -**Results** - -PrimAITE automatically creates two sets of results from each session: - -* Average reward per episode - a csv file listing the average reward for each episode of the session. This provides, for example, an indication of the change over a training session of the reward value -* All transactions - a csv file listing the following values for every step of every episode: - - * Timestamp - * Episode number - * Step number - * Reward value - * Action taken (as presented by the blue agent on this step). Individual elements of the action space are presented in the format AS_X - * Initial observation space (what the blue agent observed when it decided its action) - -**Diagrams** - -For each session, PrimAITE automatically creates a visualisation of the system / network lay down configuration. - -**Saved agents** - -For each training session, assuming the agent being trained implements the *save()* function and this function is called by the code, PrimAITE automatically saves the agent state. diff --git a/src/primaite/acl/access_control_list.py b/src/primaite/acl/access_control_list.py index 5513821a..c61b0c10 100644 --- a/src/primaite/acl/access_control_list.py +++ b/src/primaite/acl/access_control_list.py @@ -85,7 +85,13 @@ class AccessControlList: return True def add_rule( - self, _permission: str, _source_ip: str, _dest_ip: str, _protocol: str, _port: str, _position: int + self, + _permission: RulePermissionType, + _source_ip: str, + _dest_ip: str, + _protocol: str, + _port: str, + _position: str, ) -> None: """ Adds a new rule. @@ -148,7 +154,9 @@ class AccessControlList: for i in range(len(self._acl)): self._acl[i] = None - def get_dictionary_hash(self, _permission: str, _source_ip: str, _dest_ip: str, _protocol: str, _port: str) -> int: + def get_dictionary_hash( + self, _permission: RulePermissionType, _source_ip: str, _dest_ip: str, _protocol: str, _port: str + ) -> int: """ Produces a hash value for a rule. diff --git a/src/primaite/setup/old_installation_clean_up.py b/src/primaite/setup/old_installation_clean_up.py index 0fdf2757..d23abf3c 100644 --- a/src/primaite/setup/old_installation_clean_up.py +++ b/src/primaite/setup/old_installation_clean_up.py @@ -1,9 +1,8 @@ # Crown Owned Copyright (C) Dstl 2023. DEFCON 703. Shared in confidence. -from logging import Logger from primaite import getLogger -_LOGGER: Logger = getLogger(__name__) +_LOGGER = getLogger(__name__) def run() -> None: diff --git a/src/primaite/setup/reset_example_configs.py b/src/primaite/setup/reset_example_configs.py index 89a7a51f..68ce588c 100644 --- a/src/primaite/setup/reset_example_configs.py +++ b/src/primaite/setup/reset_example_configs.py @@ -2,14 +2,13 @@ import filecmp import os import shutil -from logging import Logger from pathlib import Path import pkg_resources from primaite import getLogger, USERS_CONFIG_DIR -_LOGGER: Logger = getLogger(__name__) +_LOGGER = getLogger(__name__) def run(overwrite_existing: bool = True) -> None: