From d812bb51e2769ee364eaa70ae3afd5333facd715 Mon Sep 17 00:00:00 2001 From: Stuart Axelbrooke Date: Thu, 27 Nov 2025 14:48:35 +0800 Subject: [PATCH] update multihop example --- .gitignore | 1 + databuild/cli_main.rs | 2 +- .../multihop/{config.json => databuild.json} | 0 scripts/databuild | 1 + scripts/run_multihop_example.sh | 28 +++++++++++-------- 5 files changed, 19 insertions(+), 13 deletions(-) rename examples/multihop/{config.json => databuild.json} (100%) create mode 120000 scripts/databuild diff --git a/.gitignore b/.gitignore index bf199a6..d8e18e3 100644 --- a/.gitignore +++ b/.gitignore @@ -17,6 +17,7 @@ generated_number target logs/databuild/ **/logs/databuild/ +**/.databuild # DSL generated code **/generated/ diff --git a/databuild/cli_main.rs b/databuild/cli_main.rs index f9b055f..8296f7a 100644 --- a/databuild/cli_main.rs +++ b/databuild/cli_main.rs @@ -200,8 +200,8 @@ fn cmd_status(config_path: &str) { println!("━━━━━━━━━━━━━━━━━━━━━━━━"); println!("Graph: {}", config.graph_label); println!("Status: {}", if healthy { "Running" } else if running { "Unhealthy" } else { "Stopped" }); + println!("URL: http://127.0.0.1:{}", state.port); println!("PID: {}", state.pid); - println!("Port: {}", state.port); println!("Database: {}", config.effective_bel_uri()); if config_changed { println!(); diff --git a/examples/multihop/config.json b/examples/multihop/databuild.json similarity index 100% rename from examples/multihop/config.json rename to examples/multihop/databuild.json diff --git a/scripts/databuild b/scripts/databuild new file mode 120000 index 0000000..e12feed --- /dev/null +++ b/scripts/databuild @@ -0,0 +1 @@ +../bazel-bin/databuild/databuild \ No newline at end of file diff --git a/scripts/run_multihop_example.sh b/scripts/run_multihop_example.sh index dd27226..d1ca566 100755 --- a/scripts/run_multihop_example.sh +++ b/scripts/run_multihop_example.sh @@ -3,9 +3,11 @@ set -euo pipefail # Navigate to repository root cd "$(dirname "$0")/.." +REPO_ROOT="$(pwd)" -CONFIG="examples/multihop/config.json" +EXAMPLE_DIR="$REPO_ROOT/examples/multihop" FLAG_FILE="/tmp/databuild_multihop_alpha_complete" +CLI="$REPO_ROOT/bazel-bin/databuild/databuild" echo "=== DataBuild Multi-Hop Example ===" echo @@ -13,8 +15,8 @@ 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 +rm -rf "$EXAMPLE_DIR/.databuild/" +(cd "$EXAMPLE_DIR" && "$CLI" stop 2>/dev/null || true) # Build the binary echo "Building databuild CLI..." @@ -25,34 +27,36 @@ 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) +cd "$EXAMPLE_DIR" +OUTPUT=$("$CLI" wants list 2>&1) # Extract port from status -PORT=$(./bazel-bin/databuild/databuild --config "$CONFIG" status 2>&1 | grep "Port:" | awk '{print $2}') +PORT=$("$CLI" 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 "From the examples/multihop directory, try the following commands:" +echo "(The CLI uses databuild.json by default)" echo echo " # Check server status" -echo " ./bazel-bin/databuild/databuild --config $CONFIG status" +echo " databuild status" echo echo " # Create a want for data/beta (triggers dependency chain)" -echo " ./bazel-bin/databuild/databuild --config $CONFIG want data/beta" +echo " databuild want data/beta" echo echo " # Monitor wants" -echo " ./bazel-bin/databuild/databuild --config $CONFIG wants list" +echo " databuild wants list" echo echo " # Monitor job runs" -echo " ./bazel-bin/databuild/databuild --config $CONFIG job-runs list" +echo " databuild job-runs list" echo echo " # Monitor partitions" -echo " ./bazel-bin/databuild/databuild --config $CONFIG partitions list" +echo " databuild partitions list" echo echo " # Stop the server when done" -echo " ./bazel-bin/databuild/databuild --config $CONFIG stop" +echo " databuild stop" echo echo "==========================================="