#!/bin/bash
port=8814

run_pipeline_tracker() {
    fuser -k $port/tcp
    bazel run --config=cuda -c opt //zsaf/zsaf_pipeline/airflow:pipeline_tracker -- --server.port $port
}

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