32 lines
846 B
Bash
Executable File
32 lines
846 B
Bash
Executable File
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
|
cd "$ROOT_DIR"
|
|
|
|
if [[ $# -lt 1 ]]; then
|
|
cat <<'EOF'
|
|
Usage:
|
|
scripts/rainml_py.sh <script_or_module> [args...]
|
|
|
|
Examples:
|
|
scripts/rainml_py.sh scripts/train_rain_model.py --site home --horizon-hours 4 ...
|
|
scripts/rainml_py.sh scripts/predict_rain_model.py --site home --model-name rain_next_4h --horizon-hours 4
|
|
|
|
Optional:
|
|
RAINML_PY_BUILD=1 scripts/rainml_py.sh ...
|
|
(builds the rainml image before running)
|
|
RAINML_PY_SERVICE=rainml_1h scripts/rainml_py.sh ...
|
|
(runs against a specific compose service; default is rainml)
|
|
EOF
|
|
exit 1
|
|
fi
|
|
|
|
SERVICE="${RAINML_PY_SERVICE:-rainml}"
|
|
|
|
if [[ "${RAINML_PY_BUILD:-0}" == "1" ]]; then
|
|
docker compose build "$SERVICE"
|
|
fi
|
|
|
|
docker compose run --rm --no-deps --entrypoint python3 "$SERVICE" "$@"
|