Merged PR 295: Agent action logging

## Summary
Added a new optional capability to create a JSON log each episode with a list of action each agent took each step (including scripted, RL, and red agents).

Also I had to slightly refactor the IO system to not rely on PrimaiteSession, as it's gonna be deprecated soon. Therefore the IO module is now linked to the gym environment. Each time you init a gym environment, it creates a session directory.

## Test process
Tried the SB3, Ray SARL and Ray MARL notebooks to see that the outputs get generated.

## Checklist
- [x] PR is linked to a **work item**
- [x] **acceptance criteria** of linked ticket are met
- [x] performed **self-review** of the code
- [ ] written **tests** for any new functionality added with this PR
- [x] updated the **documentation** if this PR changes or adds functionality
- [ ] written/updated **design docs** if this PR implements new functionality
- [x] updated the **change log**
- [x] ran **pre-commit** checks for code style
- [x] attended to any **TO-DOs** left in the code

Move IO to environments from session and add agent logging

Related work items: #2278
This commit is contained in:
Marek Wolan
2024-03-05 16:39:44 +00:00
10 changed files with 134 additions and 57 deletions

View File

@@ -18,7 +18,7 @@ This section configures how PrimAITE saves data during simulation and training.
checkpoint_interval: 10
# save_logs: True
# save_transactions: False
# save_tensorboard_logs: False
save_agent_actions: True
save_step_metadata: False
save_pcap_logs: False
save_sys_logs: False
@@ -55,15 +55,13 @@ Defines how often to save the policy during training.
*currently unused*.
``save_transactions``
---------------------
*currently unused*.
``save_agent_actions``
----------------------
``save_tensorboard_logs``
-------------------------
Optional. Default value is ``True``.
*currently unused*.
If ``True``, this will create a JSON file each episode detailing every agent's action in each step of that episode, formatted according to the CAOS format. This includes scripted, RL, and red agents.
``save_step_metadata``
----------------------