Skip to content

Commit 9e58c3f

Browse files
authored
Merge pull request #397 from stratosphereips/ondra-add-args-support-to-dockerun
Ondra add args support to dockerun
2 parents fe8dda7 + 8a877e6 commit 9e58c3f

File tree

3 files changed

+20
-4
lines changed

3 files changed

+20
-4
lines changed

AIDojoCoordinator/coordinator.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -957,7 +957,10 @@ def _add_step_to_trajectory(self, agent_addr:tuple, action:Action, reward:float,
957957
if end_reason:
958958
self._agent_trajectories[agent_addr]["end_reason"] = end_reason
959959

960-
def _store_trajectory_to_file(self, agent_addr:tuple, location="./trajectories")-> None:
960+
def _store_trajectory_to_file(self, agent_addr:tuple, location="./logs/trajectories")-> None:
961+
if not os.path.exists(location):
962+
os.makedirs(location)
963+
self.logger.debug(f"Created directory for storing trajectories: {location}")
961964
self.logger.debug(f"Storing Trajectory of {agent_addr}in file")
962965
if agent_addr in self._agent_trajectories:
963966
agent_name, agent_role = self.agents[agent_addr]

Dockerfile

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ RUN if [ -f pyproject.toml ]; then pip install . ; fi
2525
# Expose the port the coordinator will run on
2626
EXPOSE 9000
2727

28-
# Run the Python script when the container launches
29-
CMD ["python3", "-m", "AIDojoCoordinator.worlds.NSEGameCoordinator", "--task_config=netsecenv_conf.yaml", "--game_port=9000", "--game_host=0.0.0.0"]
28+
# 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)
29+
ENTRYPOINT ["python3", "-m", "AIDojoCoordinator.worlds.NSEGameCoordinator", "--task_config=netsecenv_conf.yaml", "--game_port=9000", "--game_host=0.0.0.0"]
3030

31+
# Default command arguments (can be overridden at runtime)
32+
CMD ["--debug_level=INFO"]

README.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,14 +113,25 @@ python3 -m AIDojoCoordinator.worlds.NSEGameCoordinator \
113113
--game_port=9000
114114
```
115115
Upon which the game server is created on `localhost:9000` to which the agents can connect to interact in the NetSecGame.
116+
116117
### Docker Container
117118
When running in the Docker container, the NetSecGame can be started with:
118119
```bash
119120
docker run -it --rm \
120121
-v $(pwd)/examples/example_task_configuration.yaml:/aidojo/netsecenv_conf.yaml \
121122
-v $(pwd)/logs:/aidojo/logs \
122-
-p 9000:9000 lukasond/aidojo-coordinator:1.0.2
123+
-p 9000:9000 stratosphereips/netsecgame:lastest
124+
```
125+
optionally, you can set the logging level with `--debug_level=["DEBUG", "INFO", "WARNING", "CRITICAL"]` (defaul=`"INFO"`):
126+
127+
```bash
128+
docker run -it --rm \
129+
-v $(pwd)/examples/example_task_configuration.yaml:/aidojo/netsecenv_conf.yaml \
130+
-v $(pwd)/logs:/aidojo/logs \
131+
-p 9000:9000 aidojo-local-test:latest \
132+
--debug_level="WARNING"
123133
```
134+
124135
## Documentation
125136
You can find user documentation at [https://stratosphereips.github.io/NetSecGame/](https://stratosphereips.github.io/NetSecGame/)
126137
## Components of the NetSecGame Environment

0 commit comments

Comments
 (0)