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

node_ip="${ARGUS_NODE_IP:?missing ARGUS_NODE_IP}"
ray_port="${ARGUS_RAY_PORT:-6379}"
dashboard_port="${ARGUS_DASHBOARD_PORT:-8265}"

export RAY_DISABLE_USAGE_STATS=1

ray stop --force || true

# Head should not run training workloads.
exec ray start \
  --head \
  --node-ip-address="${node_ip}" \
  --port="${ray_port}" \
  --dashboard-host=0.0.0.0 \
  --dashboard-port="${dashboard_port}" \
  --num-cpus="${ARGUS_HEAD_NUM_CPUS:-1}" \
  --num-gpus=0 \
  --disable-usage-stats \
  --block \
  ${ARGUS_RAY_EXTRA_ARGS:-}
