#!/usr/bin/env bash
set -euo pipefail

REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
cd "$REPO_ROOT"
export PYTHONUNBUFFERED=1
export PATH="/usr/local/bin:/usr/bin:/bin"

if [[ -x "${REPO_ROOT}/venv/bin/python" ]]; then
  exec "${REPO_ROOT}/venv/bin/python" batch_scheduled_profiling.py "$@"
elif command -v uv >/dev/null 2>&1; then
  exec uv run python batch_scheduled_profiling.py "$@"
else
  echo "run_batch_scheduled_profiling.sh: install uv or create venv (see README)." >&2
  exit 127
fi
