#!/usr/bin/env bash set -euo pipefail run_dir="${1:-_local/validation/blocked_party}" pid_file="$run_dir/model_fit.pid" log_file="$run_dir/model_fit.log" if [[ ! -f "$pid_file" ]]; then echo "No PID file at $pid_file" exit 1 fi pid="$(tr -dc '0-9' < "$pid_file")" echo "Run directory: $run_dir" echo "PID: $pid" date --iso-8601=seconds if ps -p "$pid" >/dev/null 2>&1; then echo "Status: running" ps -o pid,ppid,etimes,%cpu,%mem,rss,vsz,stat,cmd -p "$pid" echo "Model processes:" julia_pid="$(pgrep -P "$pid" -f 'julia.*01_run_model[.]jl' | head -1 || true)" if [[ -n "$julia_pid" ]]; then process_ids="$pid,$julia_pid" while IFS= read -r child_pid; do [[ -n "$child_pid" ]] && process_ids="$process_ids,$child_pid" done < <(pgrep -P "$julia_pid" || true) ps -o pid,ppid,etimes,%cpu,%mem,rss,ni,stat,cmd -p "$process_ids" else ps -eo pid,ppid,etimes,%cpu,%mem,rss,ni,stat,cmd | awk -v p="$pid" '$2 == p || $1 == p' fi else echo "Status: not running" fi echo "Latest sampler progress:" grep 'Iteration:' "$log_file" 2>/dev/null | tail -12 || true echo "Recorded sampler events:" printf ' rejected-proposal exceptions: ' grep -c '^Exception:' "$log_file" 2>/dev/null || true printf ' divergence messages: ' grep -ci 'divergent transition' "$log_file" 2>/dev/null || true echo "Disk use:" du -sh "$run_dir" _local/tmp/blocked_validation 2>/dev/null || true df -h "$run_dir" | tail -1 echo "Recent log:" tail -40 "$log_file" 2>/dev/null || true