diff --git a/AIDojoCoordinator/coordinator.py b/AIDojoCoordinator/coordinator.py index a2986c2a..dd14ad29 100644 --- a/AIDojoCoordinator/coordinator.py +++ b/AIDojoCoordinator/coordinator.py @@ -957,7 +957,10 @@ def _add_step_to_trajectory(self, agent_addr:tuple, action:Action, reward:float, if end_reason: self._agent_trajectories[agent_addr]["end_reason"] = end_reason - def _store_trajectory_to_file(self, agent_addr:tuple, location="./trajectories")-> None: + def _store_trajectory_to_file(self, agent_addr:tuple, location="./logs/trajectories")-> None: + if not os.path.exists(location): + os.makedirs(location) + self.logger.debug(f"Created directory for storing trajectories: {location}") self.logger.debug(f"Storing Trajectory of {agent_addr}in file") if agent_addr in self._agent_trajectories: agent_name, agent_role = self.agents[agent_addr] diff --git a/Dockerfile b/Dockerfile index 5efa9618..3be8548a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -25,6 +25,8 @@ RUN if [ -f pyproject.toml ]; then pip install . ; fi # Expose the port the coordinator will run on EXPOSE 9000 -# Run the Python script when the container launches -CMD ["python3", "-m", "AIDojoCoordinator.worlds.NSEGameCoordinator", "--task_config=netsecenv_conf.yaml", "--game_port=9000", "--game_host=0.0.0.0"] +# Run the Python script when the container launches (with default arguments --task_config=netsecenv_conf.yaml --game_port=9000 --game_host=0.0.0.0) +ENTRYPOINT ["python3", "-m", "AIDojoCoordinator.worlds.NSEGameCoordinator", "--task_config=netsecenv_conf.yaml", "--game_port=9000", "--game_host=0.0.0.0"] +# Default command arguments (can be overridden at runtime) +CMD ["--debug_level=INFO"] diff --git a/README.md b/README.md index 756f2936..00cefef9 100755 --- a/README.md +++ b/README.md @@ -113,14 +113,25 @@ python3 -m AIDojoCoordinator.worlds.NSEGameCoordinator \ --game_port=9000 ``` Upon which the game server is created on `localhost:9000` to which the agents can connect to interact in the NetSecGame. + ### Docker Container When running in the Docker container, the NetSecGame can be started with: ```bash docker run -it --rm \ -v $(pwd)/examples/example_task_configuration.yaml:/aidojo/netsecenv_conf.yaml \ -v $(pwd)/logs:/aidojo/logs \ - -p 9000:9000 lukasond/aidojo-coordinator:1.0.2 + -p 9000:9000 stratosphereips/netsecgame:lastest +``` +optionally, you can set the logging level with `--debug_level=["DEBUG", "INFO", "WARNING", "CRITICAL"]` (defaul=`"INFO"`): + +```bash +docker run -it --rm \ + -v $(pwd)/examples/example_task_configuration.yaml:/aidojo/netsecenv_conf.yaml \ + -v $(pwd)/logs:/aidojo/logs \ + -p 9000:9000 aidojo-local-test:latest \ + --debug_level="WARNING" ``` + ## Documentation You can find user documentation at [https://stratosphereips.github.io/NetSecGame/](https://stratosphereips.github.io/NetSecGame/) ## Components of the NetSecGame Environment