fix(admin): resolve workflows.toml path via CWD instead of __file__
In prod the package is installed in a venv, so __file__.parents[4] doesn't reach the repo root. Use CWD (repo root in both dev and prod via systemd WorkingDirectory) with REPO_ROOT env var override. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -51,8 +51,10 @@ bp = Blueprint(
|
||||
_LANDING_DIR = os.environ.get("LANDING_DIR", "data/landing")
|
||||
_SERVING_DUCKDB_PATH = os.environ.get("SERVING_DUCKDB_PATH", "data/analytics.duckdb")
|
||||
|
||||
# Repo root: web/src/padelnomics/admin/ → up 4 levels
|
||||
_REPO_ROOT = Path(__file__).resolve().parents[4]
|
||||
# In prod the package is installed in a venv so __file__.parents[4] won't
|
||||
# reach the repo checkout. WorkingDirectory in the systemd unit is /opt/padelnomics,
|
||||
# so CWD is reliable; REPO_ROOT env var overrides for non-standard setups.
|
||||
_REPO_ROOT = Path(os.environ.get("REPO_ROOT", ".")).resolve()
|
||||
_WORKFLOWS_TOML = _REPO_ROOT / "infra" / "supervisor" / "workflows.toml"
|
||||
|
||||
# A "running" row older than this is considered stale/crashed.
|
||||
|
||||
Reference in New Issue
Block a user