English: pump.py and pump.sh (ex pomper), lenzspitze_absolute.py, options --from/--to/--delay, out/pump.log; .env loaded with +u (pump.sh -h works)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
maximeandClaude Opus 5.5 committed 2026-11-16 12:40:03 +01:00
1 parent 260cd5e522
commit 5ed9f5a97a
9 files changed
+531 -530

No files matched your search

+25
View File
@@ -0,0 +1,25 @@
#!/usr/bin/env bash
# Pumping under WSL. Reads the credentials from the .env at the root of the repository (never versioned),
# runs pump.py in a throwaway uv environment (4 packages), then the post-processing of LENZSPITZE.
# extraction/pump.sh update of the tracked stations, images included (the scheduler)
# extraction/pump.sh --from D --to E [SERIAL] any other call: the arguments go to pump.py as they are
# Output appended to out/pump.log; one pumping at a time (lock out/pump.lock).
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.lock"
flock -n 9 || { echo "A pumping is already running." >&2; exit 1; }
[ $# -eq 0 ] && set -- --images --delay 300
{
echo "=== $(date -u +%Y-%m-%dT%H:%MZ) pump.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.py" "$@")
[ -f "$root/data/LENZSPITZE/lentzpitze_patterns.json" ] && python3 "$here/lenzspitze_absolute.py"
echo "=== $(date -u +%Y-%m-%dT%H:%MZ) end"
} 2>&1 | tee -a "$root/out/pump.log"