|
1 | | -import json |
2 | 1 | import os |
3 | 2 | import subprocess |
| 3 | +import time |
4 | 4 | from abc import ABC, abstractmethod |
5 | 5 | from pathlib import Path |
6 | 6 |
|
@@ -32,21 +32,28 @@ def __init__(self, config: dict, *, tournament_id: str, local_output_dir: Path): |
32 | 32 | self.url_gh: str = f"git@github.com:{GH_ORG}/{self.name}.git" |
33 | 33 | self.artifacts: list[Path] = [] |
34 | 34 | """Artifact objects that we might want to clean up after the game.""" |
35 | | - self.game_config: dict = config["game"] |
36 | 35 | self.config: dict = config |
37 | | - self.game_id: str = tournament_id |
| 36 | + self._metadata: dict = { |
| 37 | + "name": self.name, |
| 38 | + "config": self.config["game"], |
| 39 | + "game_id": tournament_id, |
| 40 | + "created_timestamp": int(time.time()), |
| 41 | + } |
38 | 42 | self.log_env: Path = (DIR_WORK / DIR_LOGS / self.game_id).resolve() |
39 | 43 | self.log_local: Path = local_output_dir |
40 | 44 | self.logger = get_logger( |
41 | 45 | self.name, log_path=self.log_local / "game.log", emoji="🏓" |
42 | 46 | ) |
43 | 47 | self.environment: DockerEnvironment = self.get_environment() |
44 | 48 | """The running docker environment for executing the game""" |
45 | | - self._metadata: dict = { |
46 | | - "name": self.name, |
47 | | - "config": self.config, |
48 | | - "game_id": self.game_id, |
49 | | - } |
| 49 | + |
| 50 | + @property |
| 51 | + def game_config(self) -> dict: |
| 52 | + return self.config["game"] |
| 53 | + |
| 54 | + @property |
| 55 | + def game_id(self) -> str: |
| 56 | + return self._metadata["game_id"] |
50 | 57 |
|
51 | 58 | @property |
52 | 59 | def image_name(self) -> str: |
|
0 commit comments