#!/usr/bin/env bash # Wait for outstanding CDS client requests, then launch the safe two-worker run. set -euo pipefail project_root=$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd) log_dir="$project_root/outputs/logs" mkdir -p "$log_dir" log_file="$log_dir/ecmwf_baseline_relaunch.log" while pgrep -u "$(id -u)" -f 'python3 -m dr_gcm.download_ecmwf_asia' >/dev/null; do printf '%s WAITING for active CDS requests to finish\n' "$(date -Is)" >>"$log_file" sleep 300 done printf '%s RELAUNCH workers=2\n' "$(date -Is)" >>"$log_file" exec bash "$project_root/scripts/submit_ecmwf_baseline_detached.sh" 1981-01 2020-12 2 >>"$log_file" 2>&1