diff --git a/sidecar/app/query/base.py b/sidecar/app/query/base.py index 2b58c71..c21bceb 100644 --- a/sidecar/app/query/base.py +++ b/sidecar/app/query/base.py @@ -30,9 +30,13 @@ class Query: logger: loguru.Logger = field(init=False, repr=False) _logger_id: int = field(init=False, repr=False) step_classes: ClassVar[list[type[Step]]] = [] + _log_dir: Path = settings.root_path / Path("logs") + _status_dir: Path = settings.root_path / Path("status_semaphore") def __post_init__(self): self.logger = logger.bind(task=self.query_id) + self._log_dir.mkdir(exist_ok=True) + self._status_dir.mkdir(exist_ok=True) self.log_file_path.touch() self._logger_id = logger.add( self.log_file_path, @@ -87,11 +91,11 @@ def running(self): @property def log_file_path(self) -> Path: - return settings.root_path / Path("logs") / Path(f"{self.query_id}.log") + return self._log_dir / Path(f"{self.query_id}.log") @property def status_file_path(self) -> Path: - return settings.root_path / Path("status_semaphore") / Path(f"{self.query_id}") + return self._status_dir / Path(f"{self.query_id}") @property def steps(self) -> Iterable[Step]: diff --git a/sidecar/cli/cli.py b/sidecar/cli/cli.py index 99e2ecc..de13f8e 100644 --- a/sidecar/cli/cli.py +++ b/sidecar/cli/cli.py @@ -22,6 +22,7 @@ def start_helper_sidecar_command( role = Role(int(identity)) network_config = config_path / Path("network.toml") root_path = root_path or Path(f"tmp/sidecar/{role.value}") + root_path.mkdir(parents=True, exist_ok=True) helpers = load_helpers_from_network_config(network_config) if role == Role.COORDINATOR: private_key_pem_path = config_path / Path("coordinator.key")