databuild/scripts/run_multihop_example.sh

58 lines
1.6 KiB
Bash
Executable file

#!/usr/bin/env bash
set -euo pipefail
# Navigate to repository root
cd "$(dirname "$0")/.."
CONFIG="examples/multihop/config.json"
FLAG_FILE="/tmp/databuild_multihop_alpha_complete"
echo "=== DataBuild Multi-Hop Example ==="
echo
# Clean up previous state
echo "Cleaning up previous state..."
rm -f "$FLAG_FILE"
rm -rf .databuild/multihop/
./bazel-bin/databuild/databuild --config "$CONFIG" stop 2>/dev/null || true
# Build the binary
echo "Building databuild CLI..."
bazel build //databuild:databuild
echo
echo "=== Starting server ==="
echo
# Start the server by making a request (triggers auto-start)
OUTPUT=$(./bazel-bin/databuild/databuild --config "$CONFIG" wants list 2>&1)
# Extract port from status
PORT=$(./bazel-bin/databuild/databuild --config "$CONFIG" status 2>&1 | grep "Port:" | awk '{print $2}')
echo
echo "Server running at: http://127.0.0.1:${PORT}"
echo
echo "=== Ready to run example ==="
echo
echo "Try the following commands:"
echo
echo " # Check server status"
echo " ./bazel-bin/databuild/databuild --config $CONFIG status"
echo
echo " # Create a want for data/beta (triggers dependency chain)"
echo " ./bazel-bin/databuild/databuild --config $CONFIG want data/beta"
echo
echo " # Monitor wants"
echo " ./bazel-bin/databuild/databuild --config $CONFIG wants list"
echo
echo " # Monitor job runs"
echo " ./bazel-bin/databuild/databuild --config $CONFIG job-runs list"
echo
echo " # Monitor partitions"
echo " ./bazel-bin/databuild/databuild --config $CONFIG partitions list"
echo
echo " # Stop the server when done"
echo " ./bazel-bin/databuild/databuild --config $CONFIG stop"
echo
echo "==========================================="