#!/usr/bin/env bash # Pumping of the differential images under WSL, into data_diff/ (never data/). Reads the credentials from the .env at # the root of the repository (never versioned) and runs pump_diff.py in the throwaway uv environment of pump.sh; no # absolute.py nor weather.py (they work on data/). # extraction/pump_diff.sh --from D [--to E] SERIAL... a range; the history of a station starts here # extraction/pump_diff.sh [SERIAL...] from the last indexed day up to now # Output appended to out/pump_diff.log; one at a time (lock out/pump_diff.lock), independent of pump.sh's. set -u export PATH="$HOME/.local/bin:$PATH" # uv, missing from the PATH when the Task Scheduler starts wsl.exe here=$(cd "$(dirname "$0")" && pwd) root=$(dirname "$here") mkdir -p "$root/out" exec 9>"$root/out/pump_diff.lock" flock -n 9 || { echo "A pumping of the differential images is already running." >&2; exit 1; } { echo "=== $(date -u +%Y-%m-%dT%H:%MZ) pump_diff.py $*" (set -a +u && . "$root/.env" && set +a -u && # +u: an unquoted $ in .env does not stop the load uv run --no-project --quiet --python 3.12 \ --with sqlalchemy --with psycopg2-binary --with pandas --with boto3 \ python "$here/pump_diff.py" "$@") echo "=== $(date -u +%Y-%m-%dT%H:%MZ) end" } 2>&1 | tee -a "$root/out/pump_diff.log"