#!/usr/bin/env bash # Formula re-run with the corrected barren rule (backend main, core_ca.yaml) on the FULL cube (with weather), # then upload in the order the site needs: fe/ -> layers/ -> cells.parquet + S.npy -> the rest. set -euo pipefail cd /root/trendex && git pull -q && git log --oneline -1 cd backend export TRENDEX_CONFIG=core_ca.yaml echo "FORMULA2_BUILD_START $(date -u +%T)" .venv/bin/python -m pipeline.build --cube /root/trendex-ca/data/cube --out artifacts_ca --clean --jobs 20 echo "FORMULA2_EXPORT_START $(date -u +%T)" TRENDEX_ARTIFACTS=artifacts_ca TRENDEX_EXPORT=export_ca/v1 .venv/bin/python scripts/30_export_static.py TRENDEX_ARTIFACTS=artifacts_ca .venv/bin/python scripts/35_export_frontend.py du -sh artifacts_ca artifacts_ca/layers export_ca/v1 export/ca/v1/fe || true python - <<'PY' from pathlib import Path from huggingface_hub import HfApi api, repo, b = HfApi(), "TrendeX90/ca-cube", Path("/root/trendex/backend") def folder(local, remote, **kw): api.upload_folder(repo_id=repo, repo_type="dataset", folder_path=str(local), path_in_repo=remote, commit_message=f"formula v2 (barren rule): {remote}", **kw) print("pushed", remote, flush=True) folder(b / "export/ca/v1/fe", "formula/export/ca/v1/fe") folder(b / "artifacts_ca/layers", "formula/artifacts_ca/layers") for f in ("cells.parquet", "S.npy"): api.upload_file(path_or_fileobj=str(b / "artifacts_ca" / f), path_in_repo=f"formula/artifacts_ca/{f}", repo_id=repo, repo_type="dataset", commit_message=f"formula v2: artifacts_ca/{f}") print("pushed", f, flush=True) folder(b / "export_ca/v1", "formula/export_ca/v1") folder(b / "artifacts_ca", "formula/artifacts_ca", ignore_patterns=["*.npy", "*.npz", "layers/**", "cells.parquet"]) PY echo "FORMULA2_DONE $(date -u +%T)"