a
This commit is contained in:
parent
2d9adddb91
commit
52e849a586
|
|
@ -32,7 +32,8 @@ DEFAULT_CANDIDATE_CONFS = [
|
|||
|
||||
def _get_project_root() -> Path:
|
||||
# backend/api/supervisor_account.py -> api -> backend -> project_root
|
||||
return Path(__file__).resolve().parents[2].parent
|
||||
# 期望得到:<project_root>(例如 /www/wwwroot/autosys_new)
|
||||
return Path(__file__).resolve().parents[2]
|
||||
|
||||
|
||||
def _detect_supervisor_conf_path() -> Optional[Path]:
|
||||
|
|
@ -128,6 +129,13 @@ def render_program_ini(account_id: int, program_name: str) -> str:
|
|||
|
||||
# 日志目录可通过环境变量覆盖
|
||||
log_dir = Path(os.getenv("TRADING_LOG_DIR", str(project_root / "logs"))).expanduser()
|
||||
# supervisor 在 reread/update 时会校验 logfile 目录是否存在;这里提前创建避免 CANT_REREAD
|
||||
try:
|
||||
log_dir.mkdir(parents=True, exist_ok=True)
|
||||
except Exception:
|
||||
# 最后兜底到 /tmp,确保一定存在
|
||||
log_dir = Path("/tmp") / "autosys_logs"
|
||||
log_dir.mkdir(parents=True, exist_ok=True)
|
||||
out_log = log_dir / f"trading_{int(account_id)}.out.log"
|
||||
err_log = log_dir / f"trading_{int(account_id)}.err.log"
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user