diff --git a/web/src/padelnomics/admin/pipeline_routes.py b/web/src/padelnomics/admin/pipeline_routes.py index 2cee34e..cd687ea 100644 --- a/web/src/padelnomics/admin/pipeline_routes.py +++ b/web/src/padelnomics/admin/pipeline_routes.py @@ -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.