#!/usr/bin/env bash # Run the backend formula (github.com/Konuktor/trendex, core_ca.yaml) on a frozen hard-link snapshot of the CA cube, # so the weather stage can swap monthly/ underneath without disturbing it. Then push formula outputs to HF. set -euo pipefail SNAP=/root/trendex-ca/data/cube_formula rm -rf "$SNAP" && mkdir -p "$SNAP" cp -al /root/trendex-ca/data/cube/monthly "$SNAP/monthly" cp /root/trendex-ca/data/cube/cells.parquet /root/trendex-ca/data/cube/manifest.json "$SNAP/" cd /root/trendex && git pull -q && git log --oneline -1 cd backend export TRENDEX_CONFIG=core_ca.yaml echo "FORMULA_BUILD_START $(date -u +%T)" .venv/bin/python -m pipeline.build --cube "$SNAP" --out artifacts_ca --clean --jobs 20 echo "FORMULA_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 export_ca/v1 export/ca/v1/fe || true python /root/trendex-ca/scripts/50_push_ca.py formula echo "FORMULA_DONE $(date -u +%T)"