Skip to content

[WIP] chore: add switchyard-server wiring to benchmarks - #177

Draft
ayushag-nv wants to merge 2 commits into
mainfrom
ayushag/switchyard-server-benchmarking
Draft

[WIP] chore: add switchyard-server wiring to benchmarks#177
ayushag-nv wants to merge 2 commits into
mainfrom
ayushag/switchyard-server-benchmarking

Conversation

@ayushag-nv

@ayushag-nv ayushag-nv commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

What

  • Update benchmark Dockerfile to use switchyard-server with server-config

Why

Currently Switchyard benchmarking suite uses old python server path to run the benchmarks. With the migration of routing algos to the libsy and the new rust switchyard-server, the benchmark flow also needs to follow this path

Closes SWITCH-119

How tested

  • uv run ruff check . clean
  • uv run mypy switchyard clean
  • uv run pytest tests/ green
  • Manual smoke (describe what was run)

Checklist

  • One class per file; filename = snake_case of the primary class.
  • New public symbols exported from switchyard/__init__.py.__all__ if intended for downstream use.
  • Unit tests added for new components / bug fixes.
  • README / --help updated if customer-facing surface changed.
  • Commits signed off (Signed-off-by: Your Name <email>) per the DCO.

Notes for reviewers

Anything reviewers should pay extra attention to — risky paths, follow-up tickets, intentional trade-offs.

Summary by CodeRabbit

  • New Features

    • Added TOML-based server configuration options for benchmark runs.
    • Added ready-to-use configurations for single-model and classifier-based routing.
    • Added server configuration snapshots and final server metrics to benchmark artifacts.
  • Documentation

    • Updated benchmark instructions, commands, provider setup, and artifact guidance for the new server configuration workflow.
  • Bug Fixes

    • Improved validation and error messages for direct-upstream and configured server modes.
    • Rejected the legacy routing profile option in favor of server configuration.
  • Refactor

    • Updated the benchmark server container to use the Rust-based server runtime.

Signed-off-by: ayushag <ayushag@nvidia.com>
@ayushag-nv
ayushag-nv requested a review from a team as a code owner July 29, 2026 07:51
@ayushag-nv
ayushag-nv marked this pull request as draft July 29, 2026 07:53
@coderabbitai

coderabbitai Bot commented Jul 29, 2026

Copy link
Copy Markdown

Review Change Stack

Walkthrough

Changes

Rust Switchyard Benchmark Migration

Layer / File(s) Summary
Rust server runtime and benchmark configurations
benchmark/server-configs/*, benchmark/switchyard-server.Dockerfile
Adds TOML route configurations and changes the container image to build and run switchyard-server.
Baseline launch and metrics collection
benchmark/run-baseline.sh
Replaces routing-profile handling with --server-config, updates Switchyard startup and mounts, and collects server metrics.
Manifest snapshots and finalization
benchmark/run_manifest.py
Snapshots server configurations and records or copies server metrics artifacts and statuses.
Documentation and workflow validation
benchmark/README.md, benchmark/DATASETS.md, tests/*
Updates benchmark instructions and tests for server-config routing, Rust server execution, manifest snapshots, and metrics outputs.

Estimated code review effort: 4 (Complex) | ~45 minutes

Poem

A rabbit hops through TOML lanes,
Rust servers hum beneath the plains.
Metrics sparkle, manifests grow,
Old route profiles fade below.
“Configured!” I thump with cheer.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: wiring switchyard-server into the benchmark flow.
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Fix failing CI checks

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@benchmark/run-baseline.sh`:
- Around line 879-880: Update the SERVER_CONFIG_DIR condition in the Docker
mount argument logic to recognize REPO_ROOT only when it is the directory itself
or has a path-separator boundary, not merely a string prefix. Ensure sibling
paths such as /work/repo-configs still receive the read-only bind mount while
paths under REPO_ROOT continue to be skipped.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: adef066f-7ed5-46ce-b6a5-292366d962ae

📥 Commits

Reviewing files that changed from the base of the PR and between e4632e3 and be9aaef.

📒 Files selected for processing (10)
  • benchmark/DATASETS.md
  • benchmark/README.md
  • benchmark/run-baseline.sh
  • benchmark/run_manifest.py
  • benchmark/server-configs/tb-lite-llm-classifier-opus-kimi-gemini.toml
  • benchmark/server-configs/tb-lite-single-gpt-5-5.toml
  • benchmark/server-configs/tb-lite-single-opus-4-7.toml
  • benchmark/switchyard-server.Dockerfile
  • tests/test_run_baseline_script.py
  • tests/test_run_manifest.py

Comment thread benchmark/run-baseline.sh
Comment on lines +879 to +880
if [[ -n "\${SERVER_CONFIG_DIR}" && "\${SERVER_CONFIG_DIR}" != "\${REPO_ROOT}"* ]]; then
DOCKER_RUN_ARGS+=(-v "\${SERVER_CONFIG_DIR}:\${SERVER_CONFIG_DIR}:ro")

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win

Use a directory-boundary check before skipping the config mount.

Line 879 treats /work/repo-configs as inside /work/repo because ${REPO_ROOT}* is a plain prefix match. The bind mount is skipped, but the container still receives that absolute config path and fails to open it.

Proposed fix
-    if [[ -n "${SERVER_CONFIG_DIR}" && "${SERVER_CONFIG_DIR}" != "${REPO_ROOT}"* ]]; then
+    repo_prefix="${REPO_ROOT%/}/"
+    if [[ -n "${SERVER_CONFIG_DIR}" \
+        && "${SERVER_CONFIG_DIR}" != "${REPO_ROOT}" \
+        && "${SERVER_CONFIG_DIR}" != "${repo_prefix}"* ]]; then
         DOCKER_RUN_ARGS+=(-v "${SERVER_CONFIG_DIR}:${SERVER_CONFIG_DIR}:ro")
     fi
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
if [[ -n "\${SERVER_CONFIG_DIR}" && "\${SERVER_CONFIG_DIR}" != "\${REPO_ROOT}"* ]]; then
DOCKER_RUN_ARGS+=(-v "\${SERVER_CONFIG_DIR}:\${SERVER_CONFIG_DIR}:ro")
repo_prefix="${REPO_ROOT%/}/"
if [[ -n "${SERVER_CONFIG_DIR}" \
&& "${SERVER_CONFIG_DIR}" != "${REPO_ROOT}" \
&& "${SERVER_CONFIG_DIR}" != "${repo_prefix}"* ]]; then
DOCKER_RUN_ARGS+=(-v "${SERVER_CONFIG_DIR}:${SERVER_CONFIG_DIR}:ro")
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@benchmark/run-baseline.sh` around lines 879 - 880, Update the
SERVER_CONFIG_DIR condition in the Docker mount argument logic to recognize
REPO_ROOT only when it is the directory itself or has a path-separator boundary,
not merely a string prefix. Ensure sibling paths such as /work/repo-configs
still receive the read-only bind mount while paths under REPO_ROOT continue to
be skipped.

Signed-off-by: ayushag <ayushag@nvidia.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant