#!/bin/bash
port=8812

run_boreal_visualizer() {
    fuser -k $port/tcp
    bazel run --config=cuda -c opt //zsaf/bayesian_optimization/boreal:boreal_visualizer -- --server.port $port
}

until run_boreal_visualizer; do
    echo "Service crashed with exit code $?. Restarting in 5 seconds..." >&2
    sleep 5
done
