Files
PrimAITE/src/primaite/simulator/__init__.py

30 lines
782 B
Python
Raw Normal View History

2023-11-17 10:20:26 +00:00
"""Warning: SIM_OUTPUT is a mutable global variable for the simulation output directory."""
from datetime import datetime
2023-11-17 10:20:26 +00:00
from pathlib import Path
from primaite import _PRIMAITE_ROOT
2023-11-17 10:20:26 +00:00
__all__ = ["SIM_OUTPUT"]
2023-11-17 10:20:26 +00:00
2024-01-05 11:25:57 +00:00
class _SimOutput:
2023-11-17 10:20:26 +00:00
def __init__(self):
self._path: Path = (
_PRIMAITE_ROOT.parent.parent / "simulation_output" / datetime.now().strftime("%Y-%m-%d_%H-%M-%S")
)
self.save_pcap_logs: bool = False
self.save_sys_logs: bool = False
2024-04-15 11:50:08 +01:00
self.write_sys_log_to_terminal: bool = False
2023-11-17 10:20:26 +00:00
@property
def path(self) -> Path:
return self._path
@path.setter
def path(self, new_path: Path) -> None:
self._path = new_path
self._path.mkdir(exist_ok=True, parents=True)
2024-01-05 11:25:57 +00:00
SIM_OUTPUT = _SimOutput()