Skip to content

test: Add vLLM integration tests - #261

Closed
ptarasiewiczNV wants to merge 6 commits into
mainfrom
ptarasiewicz/move-tests-to-dynamo
Closed

ptarasiewiczNV wants to merge 6 commits into
mainfrom
ptarasiewicz/move-tests-to-dynamo

Conversation

@ptarasiewiczNV

@ptarasiewiczNV ptarasiewiczNV commented Mar 18, 2025 •

Copy link
Copy Markdown
Contributor

Overview:

Add basic vLLM e2e tests that follow the examples

Details:

Each test can be run inside the container by running the test script:

./tests/vllm/<test name>/test.sh

Where should the reviewer start?

Related Issues: (use one of the action keywords Closes / Fixes / Resolves / Relates to)

  • closes GitHub issue: #xxx

Summary by CodeRabbit

  • Chores
    • Added installation of the yq utility to the build image.
  • Tests
    • Introduced multiple new test scripts to validate deterministic behavior for various LLM serving configurations, including both aggregated and disaggregated setups, with and without KV routing.
    • Added a script to automate pre-merge testing with detailed reporting.
  • New Features
    • Added a utility script with helper functions for testing and environment management.

@copy-pr-bot

copy-pr-bot Bot commented Mar 18, 2025

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@ptarasiewiczNV ptarasiewiczNV changed the title tests: Add vLLM integration tests test: Add vLLM integration tests Mar 18, 2025
Comment thread tests/vllm/utils.sh Resolved
Comment thread tests/vllm/utils.sh Resolved
@ptarasiewiczNV
ptarasiewiczNV marked this pull request as ready for review March 18, 2025 15:19
@ptarasiewiczNV
ptarasiewiczNV force-pushed the ptarasiewicz/move-tests-to-dynamo branch from 8c9dd7c to 67d0360 Compare March 19, 2025 13:35
@ptarasiewiczNV
ptarasiewiczNV requested a review from a team March 19, 2025 13:35
@saturley-hall

saturley-hall commented Mar 19, 2025 •

Copy link
Copy Markdown
Member

My first thought is, yay testing! And different levels of impact! Can you please elaborate on when you think different testing levels should run and the runtime implications of each level?

My second thought is @pvijayakrish should have eyes on this as she has been thinking about what executing the test suite should look like. To my eyes this is largely replicating the test framework of Triton and that comes with limitations of legibility and reporting if we don't conform to standard testing output formats. After @pvijayakrish weighs in on how to proceed, I would like to see these changes reflected in the public workflow.

Finally, if you would can you fill in these answers in the overview of this PR?

@ptarasiewiczNV

Copy link
Copy Markdown
Contributor Author

This is just a very first set of tests that only cover the examples, I think these are must have. The biggest problems with them is that some of them require > 1 GPUs (disagg configs) and it may take some time until the jobs are allocated.

For that reason I am fine in running L1 post merge. Maybe something like:

  • L0 (basic functionality, requires 1 GPU max) - pre merge
  • L1 (basic functionality, requires 1/2 GPU max) - post merge (but preferably pre merge in the future)
  • L2 (core functionalities but at small scale, 1 or 2 nodes, single configs) - post merge
  • L3 (benchmarks at scale, multiple configs, many nodes) - nightly and pre release

But even if the configuration will be changed in the future I think it's very important and urgent to have at least this basic set of tests from this PR run post merge.

done

echo "=============================================================="
echo "✅ SUCCESS: All responses are identical - deterministic behavior confirmed"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Do emojis get rendered in bash?

@ishandhanani

Copy link
Copy Markdown
Contributor

This is great Piotr - I'm not sure how our GPUs for CI work but it would be great if these could run nightly. The current 4 examples should never be broken on main

wait_for_server "$HOST:$PORT" $SERVED_MODEL_NAME || exit 1

echo "Checking if responses are deterministic..."
first_response=""

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

There is a lot of code duplication. All the tests have similar structure:

  • run deployment according to given config
  • check if the answer make sense ('Paris' in the response)
  • check if the answers are deterministic
    Couldn't we make some reusable code?

Anyway, I don't mind merging it now and polishing later.

@saturley-hall
saturley-hall force-pushed the ptarasiewicz/move-tests-to-dynamo branch from d3f2398 to ff52cf0 Compare April 11, 2025 03:28
@github-actions

Copy link
Copy Markdown
Contributor

This PR is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.

@github-actions github-actions Bot added the Stale label Jun 23, 2025
@coderabbitai

coderabbitai Bot commented Jun 23, 2025 •

Copy link
Copy Markdown
Contributor

Walkthrough

This update introduces several new shell scripts for automated testing of deterministic behavior in various LLM serving configurations, including both aggregated and disaggregated setups with and without KV routing. It also adds a Bash utility script with helper functions for test orchestration and updates the Dockerfile to install the yq YAML processor.

Changes

File(s) Change Summary
container/Dockerfile.vllm Added installation of yq utility to the build image.
tests/vllm/utils.sh New Bash utility script with helper functions for server readiness, process cleanup, and env parsing.
tests/vllm/L0_pre_merge/test.sh New script to run pre-merge tests with pytest and generate reports.
tests/vllm/L1_deploy_examples_llm_aggregated_serving/test.sh New script to test deterministic output for aggregated LLM serving.
tests/vllm/L1_deploy_examples_llm_aggregated_serving_with_kv_routing/test.sh New script to test deterministic output for aggregated LLM serving with KV routing.
tests/vllm/L1_deploy_examples_llm_disaggregated_serving/test.sh New script to test deterministic output for disaggregated LLM serving.
tests/vllm/L1_deploy_examples_llm_disaggregated_serving_with_kv_routing/test.sh New script to test deterministic output for disaggregated LLM serving with KV routing.

Sequence Diagram(s)

sequenceDiagram
    participant Tester as Test Script
    participant Env as Test Environment
    participant NATS as NATS Server
    participant ETCD as etcd Server
    participant LLM as LLM Frontend Service

    Tester->>Env: Set up environment variables
    Tester->>Env: Install dependencies (e.g., hf-transfer)
    Tester->>NATS: Start NATS server
    Tester->>ETCD: Start etcd server
    Tester->>Env: Source utility functions
    Tester->>NATS: Wait for readiness
    Tester->>ETCD: Wait for readiness
    Tester->>LLM: Launch LLM frontend service
    Tester->>LLM: Wait for server readiness
    loop 10 times
        Tester->>LLM: Send chat completion request (fixed seed, temp=0)
        LLM-->>Tester: Return response
    end
    Tester->>Tester: Verify all responses are identical and contain expected answer
    Tester-->>Env: Print success or failure
Loading

Poem

🐇
Scripts now hop and tests now run,
Deterministic answers—ten out of one!
With yq in the Docker den,
And utils to clean up time and again.
Aggregated, routed, disaggregated too—
The rabbits ensure all outputs stay true!

✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 7

♻️ Duplicate comments (4)
tests/vllm/L1_deploy_examples_llm_disaggregated_serving/test.sh (3)

27-27: Quote source path

Wrap the sourced path in quotes to handle spaces:

-source $SCRIPT_DIR/../utils.sh
+source "$SCRIPT_DIR"/../utils.sh

42-45: Anchor and quote yq invocations

-   SERVED_MODEL_NAME=$(yq .Frontend.model $CONFIG_FILE)
+   SERVED_MODEL_NAME=$(yq eval '.Frontend.model' "$CONFIG_FILE")
-   PORT=$(yq .Frontend.port $CONFIG_FILE)
+   PORT=$(yq eval '.Frontend.port' "$CONFIG_FILE")

53-67: Quote SERVED_MODEL_NAME in JSON payload and use raw output

-    response=$(curl -s -X POST http://$HOST:$PORT/v1/chat/completions \
-            -H "Content-Type: application/json" \
-            -d '{
-                "model": '$SERVED_MODEL_NAME',
-                ...
-            }')
+    response=$(curl -s -X POST "http://$HOST:$PORT/v1/chat/completions" \
+            -H "Content-Type: application/json" \
+            -d '{
+                "model": "'"$SERVED_MODEL_NAME"'",
+                ...
+            }')
@@
-    completion=$(echo "$response" | jq .choices[0].message.content)
+    completion=$(echo "$response" | jq -r .choices[0].message.content)
tests/vllm/L1_deploy_examples_llm_disaggregated_serving_with_kv_routing/test.sh (1)

49-91: Duplicate test logic across scripts.
This deterministic-response loop is duplicated in multiple test.sh files. Consider extracting it into a helper in utils.sh (e.g. run_deterministic_test) and parameterizing the endpoint, prompt, expected token, and repeat count.

🧹 Nitpick comments (11)
container/Dockerfile.vllm (1)

159-159: Unify APT usage and cleanup to reduce image size

Use apt-get consistently, enable --no-install-recommends, and clean up the apt cache to keep the image lean:

-RUN apt update -y && apt install -y git wget curl nvtop tmux vim yq
+RUN apt-get update -y && \
+    apt-get install -y --no-install-recommends git wget curl nvtop tmux vim yq && \
+    rm -rf /var/lib/apt/lists/*
tests/vllm/utils.sh (3)

1-4: Consider enabling strict error modes

Adding set -euo pipefail at the top will catch unbound variables and pipeline failures early:

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

30-31: Remove unused host and port variables

The locals host and port are assigned but never used. Removing them cleans up the function:

-local host=$(echo $host_port | cut -d ':' -f 1)
-local port=$(echo $host_port | cut -d ':' -f 2)

110-113: Quote expansions to prevent word splitting

Wrap variable expansions in quotes when echoing or piping:

-      echo $(echo $SLURM_NODELIST | cut -d',' -f1)
+      echo "$(echo "$SLURM_NODELIST" | cut -d',' -f1)"
tests/vllm/L0_pre_merge/test.sh (1)

24-24: Address the TODO for mypy checks

The placeholder indicates missing type checking. Consider re-enabling mypy or removing this TODO. Let me know if you’d like assistance integrating mypy.

tests/vllm/L1_deploy_examples_llm_aggregated_serving_with_kv_routing/test.sh (1)

27-27: Quote source path

Wrap the sourced path in quotes to handle spaces:

-source $SCRIPT_DIR/../utils.sh
+source "$SCRIPT_DIR"/../utils.sh
tests/vllm/L1_deploy_examples_llm_disaggregated_serving_with_kv_routing/test.sh (2)

26-27: Quote $SCRIPT_DIR when sourcing.
Wrap the path in quotes to guard against spaces/globbing:

- source $SCRIPT_DIR/../utils.sh
+ source "$SCRIPT_DIR/../utils.sh"

18-18: Enable strict error handling.
Replace set -ex with:

- set -ex
+ set -euxo pipefail

to catch unset variables and pipeline failures.

tests/vllm/L1_deploy_examples_llm_aggregated_serving/test.sh (3)

49-91: Extract the common deterministic-response loop.
This loop is duplicated across test scripts. Consider factoring it into utils.sh (e.g. run_deterministic_test) to reduce duplication and improve maintainability.


26-27: Quote $SCRIPT_DIR when sourcing.
Ensure the path is quoted:

- source $SCRIPT_DIR/../utils.sh
+ source "$SCRIPT_DIR/../utils.sh"

18-18: Enable stricter shell flags.
Consider using:

- set -ex
+ set -euxo pipefail

to catch unset variables and pipeline errors.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e7a49b0 and ff52cf0.

📒 Files selected for processing (7)
  • container/Dockerfile.vllm (1 hunks)
  • tests/vllm/L0_pre_merge/test.sh (1 hunks)
  • tests/vllm/L1_deploy_examples_llm_aggregated_serving/test.sh (1 hunks)
  • tests/vllm/L1_deploy_examples_llm_aggregated_serving_with_kv_routing/test.sh (1 hunks)
  • tests/vllm/L1_deploy_examples_llm_disaggregated_serving/test.sh (1 hunks)
  • tests/vllm/L1_deploy_examples_llm_disaggregated_serving_with_kv_routing/test.sh (1 hunks)
  • tests/vllm/utils.sh (1 hunks)
🧰 Additional context used
🪛 Shellcheck (0.10.0)
tests/vllm/utils.sh

[warning] 30-30: host appears unused. Verify use (or export if used externally).

(SC2034)


[warning] 30-30: Declare and assign separately to avoid masking return values.

(SC2155)


[warning] 31-31: port appears unused. Verify use (or export if used externally).

(SC2034)


[warning] 31-31: Declare and assign separately to avoid masking return values.

(SC2155)


[warning] 74-74: Declare and assign separately to avoid masking return values.

(SC2155)


[warning] 112-112: Quote this to prevent word splitting.

(SC2046)

🔇 Additional comments (3)
tests/vllm/L1_deploy_examples_llm_aggregated_serving_with_kv_routing/test.sh (1)

42-45: Anchor and quote yq invocations

Explicitly quote variables and use the compatible eval subcommand:

-   SERVED_MODEL_NAME=$(yq .Frontend.model $CONFIG_FILE)
+   SERVED_MODEL_NAME=$(yq eval '.Frontend.model' "$CONFIG_FILE")
-   PORT=$(yq .Frontend.port $CONFIG_FILE)
+   PORT=$(yq eval '.Frontend.port' "$CONFIG_FILE")

Verify your yq version supports this syntax.

tests/vllm/L1_deploy_examples_llm_aggregated_serving/test.sh (2)

37-38: Good use of service readiness helpers.
Using wait_for_nats and wait_for_etcd replaces brittle sleeps and aligns with past feedback.


40-45: Fetching config via yq addresses previous suggestions.
Retrieving model and port from agg.yaml with yq is implemented correctly here.

Comment thread tests/vllm/utils.sh
Comment on lines +37 to +49
if curl -s -X POST http://$host_port/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{
"model": '$model',
"messages": [
{
"role": "user",
"content": "test"
}
],
"stream": false,
"max_tokens": 5
}' | grep -q "content"; then

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Quote model in JSON payload to prevent invalid JSON and injection

Wrap $model in double quotes in the JSON body:

-        if curl -s -X POST http://$host_port/v1/chat/completions \
+        if curl -s -X POST "http://$host_port/v1/chat/completions" \
             -H "Content-Type: application/json" \
-            -d '{
-                "model": '$model',
+            -d '{
+                "model": "'"$model"'",
                 "messages": [
                     {
                         "role": "user",
                         "content": "test"
                     }
                 ],
                 "stream": false,
                 "max_tokens": 5
             }' | grep -q "content"; then
📝 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 curl -s -X POST http://$host_port/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{
"model": '$model',
"messages": [
{
"role": "user",
"content": "test"
}
],
"stream": false,
"max_tokens": 5
}' | grep -q "content"; then
if curl -s -X POST "http://$host_port/v1/chat/completions" \
-H "Content-Type: application/json" \
-d '{
"model": "'"$model"'",
"messages": [
{
"role": "user",
"content": "test"
}
],
"stream": false,
"max_tokens": 5
}' | grep -q "content"; then
🤖 Prompt for AI Agents
In tests/vllm/utils.sh around lines 37 to 49, the $model variable in the JSON
payload is not quoted, which can produce invalid JSON or allow injection. Fix
this by wrapping $model in double quotes inside the JSON string to ensure it is
treated as a proper JSON string value.

Comment on lines +20 to +23
TEST_NAME="$(basename "$(dirname "$(readlink -f "$0")")")"
OUTPUT_DIR=${OUTPUT_DIR:-$PWD/.tests_outputs/${TEST_NAME}}
DYNAMO_REPO_DIR=${DYNAMO_REPO_DIR:-$PWD}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Ensure output directory exists before running pytest

Create the output directory to avoid write errors:

-OUTPUT_DIR=${OUTPUT_DIR:-$PWD/.tests_outputs/${TEST_NAME}}
+OUTPUT_DIR=${OUTPUT_DIR:-$PWD/.tests_outputs/${TEST_NAME}}
+mkdir -p "${OUTPUT_DIR}"
📝 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
TEST_NAME="$(basename "$(dirname "$(readlink -f "$0")")")"
OUTPUT_DIR=${OUTPUT_DIR:-$PWD/.tests_outputs/${TEST_NAME}}
DYNAMO_REPO_DIR=${DYNAMO_REPO_DIR:-$PWD}
TEST_NAME="$(basename "$(dirname "$(readlink -f "$0")")")"
OUTPUT_DIR=${OUTPUT_DIR:-$PWD/.tests_outputs/${TEST_NAME}}
mkdir -p "${OUTPUT_DIR}"
DYNAMO_REPO_DIR=${DYNAMO_REPO_DIR:-$PWD}
🤖 Prompt for AI Agents
In tests/vllm/L0_pre_merge/test.sh around lines 20 to 23, the script sets the
OUTPUT_DIR variable but does not ensure the directory exists, which can cause
write errors during pytest execution. Add a command to create the OUTPUT_DIR
directory if it does not already exist, using mkdir with appropriate flags to
create parent directories as needed before running pytest.

Comment on lines +53 to +67
response=$(curl -s -X POST http://$HOST:$PORT/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{
"model": '$SERVED_MODEL_NAME',
"messages": [
{
"role": "user",
"content": "What is capital of France?"
}
],
"seed": 1,
"temperature": 0.0,
"stream": false,
"max_tokens": 100
}')

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Quote SERVED_MODEL_NAME in JSON payload and use raw output

Wrap the model name in quotes and extract the content with jq -r to avoid embedded quotes in the comparison:

-    response=$(curl -s -X POST http://$HOST:$PORT/v1/chat/completions \
-            -H "Content-Type: application/json" \
-            -d '{
-                "model": '$SERVED_MODEL_NAME',
-                ...
-            }')
+    response=$(curl -s -X POST "http://$HOST:$PORT/v1/chat/completions" \
+            -H "Content-Type: application/json" \
+            -d '{
+                "model": "'"$SERVED_MODEL_NAME"'",
+                ...
+            }')
@@
-    completion=$(echo "$response" | jq .choices[0].message.content)
+    completion=$(echo "$response" | jq -r .choices[0].message.content)
📝 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
response=$(curl -s -X POST http://$HOST:$PORT/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{
"model": '$SERVED_MODEL_NAME',
"messages": [
{
"role": "user",
"content": "What is capital of France?"
}
],
"seed": 1,
"temperature": 0.0,
"stream": false,
"max_tokens": 100
}')
response=$(curl -s -X POST "http://$HOST:$PORT/v1/chat/completions" \
-H "Content-Type: application/json" \
-d '{
"model": "'"$SERVED_MODEL_NAME"'",
"messages": [
{
"role": "user",
"content": "What is capital of France?"
}
],
"seed": 1,
"temperature": 0.0,
"stream": false,
"max_tokens": 100
}')
completion=$(echo "$response" | jq -r .choices[0].message.content)
🤖 Prompt for AI Agents
In tests/vllm/L1_deploy_examples_llm_aggregated_serving_with_kv_routing/test.sh
around lines 53 to 67, the SERVED_MODEL_NAME variable is not quoted in the JSON
payload, which can cause invalid JSON if the model name contains special
characters. Fix this by wrapping the model name in double quotes inside the JSON
string. Also, when extracting the response content for comparison, use jq with
the -r flag to get raw output without embedded quotes.

Comment on lines +53 to +67
response=$(curl -s -X POST http://$HOST:$PORT/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{
"model": '$SERVED_MODEL_NAME',
"messages": [
{
"role": "user",
"content": "We will start with some tokens to actually trigger disaggregation. What is capital of France?"
}
],
"seed": 1,
"temperature": 0.0,
"stream": false,
"max_tokens": 100
}')

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Quote the model name in the JSON payload.
The current construction

-d '{
    "model": '$SERVED_MODEL_NAME',
    …
}'

will emit unquoted model names (invalid JSON). Use:

- "model": '$SERVED_MODEL_NAME',
+ "model": "'"$SERVED_MODEL_NAME"'",  

or switch to a here-doc for clarity.

🤖 Prompt for AI Agents
In
tests/vllm/L1_deploy_examples_llm_disaggregated_serving_with_kv_routing/test.sh
between lines 53 and 67, the model name variable $SERVED_MODEL_NAME is inserted
into the JSON payload without quotes, resulting in invalid JSON. Fix this by
enclosing the model name in double quotes within the JSON string, or
alternatively, refactor the curl command to use a here-document to clearly and
correctly format the JSON payload with proper quoting.



export HF_HUB_ENABLE_HF_TRANSFER=1
uv pip install hf-transfer

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Fix the pip install command.
The line uv pip install hf-transfer is invalid and will fail. It should be:

- uv pip install hf-transfer
+ pip install hf-transfer
📝 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
uv pip install hf-transfer
pip install hf-transfer
🤖 Prompt for AI Agents
In
tests/vllm/L1_deploy_examples_llm_disaggregated_serving_with_kv_routing/test.sh
at line 22, the command `uv pip install hf-transfer` is invalid. Replace it with
the correct pip install command by removing the `uv` prefix so it reads `pip
install hf-transfer`.



export HF_HUB_ENABLE_HF_TRANSFER=1
uv pip install hf-transfer

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Fix the pip install command.
The line uv pip install hf-transfer is invalid and will fail. It should be:

- uv pip install hf-transfer
+ pip install hf-transfer
📝 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
uv pip install hf-transfer
# Before (line 22 in tests/vllm/L1_deploy_examples_llm_aggregated_serving/test.sh)
- uv pip install hf-transfer
# After
pip install hf-transfer
🤖 Prompt for AI Agents
In tests/vllm/L1_deploy_examples_llm_aggregated_serving/test.sh at line 22, the
command `uv pip install hf-transfer` is invalid and will cause an error. Replace
`uv` with the correct command prefix or remove it entirely so that the line
correctly runs `pip install hf-transfer`.

Comment on lines +53 to +67
response=$(curl -s -X POST http://$HOST:$PORT/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{
"model": '$SERVED_MODEL_NAME',
"messages": [
{
"role": "user",
"content": "What is capital of France?"
}
],
"seed": 1,
"temperature": 0.0,
"stream": false,
"max_tokens": 100
}')

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Quote the model name in the JSON payload.
As in the other test, this will emit unquoted values. Change to:

- "model": '$SERVED_MODEL_NAME',
+ "model": "'"$SERVED_MODEL_NAME"'",  

or use a here-doc block for JSON.

📝 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
response=$(curl -s -X POST http://$HOST:$PORT/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{
"model": '$SERVED_MODEL_NAME',
"messages": [
{
"role": "user",
"content": "What is capital of France?"
}
],
"seed": 1,
"temperature": 0.0,
"stream": false,
"max_tokens": 100
}')
response=$(curl -s -X POST http://$HOST:$PORT/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{
"model": "'"$SERVED_MODEL_NAME"'",
"messages": [
{
"role": "user",
"content": "What is capital of France?"
}
],
"seed": 1,
"temperature": 0.0,
"stream": false,
"max_tokens": 100
}')
🤖 Prompt for AI Agents
In tests/vllm/L1_deploy_examples_llm_aggregated_serving/test.sh between lines 53
and 67, the model name variable SERVED_MODEL_NAME is not quoted in the JSON
payload, causing it to be emitted as an unquoted value. Fix this by enclosing
the model name variable in double quotes within the JSON string to ensure it is
properly quoted. Alternatively, refactor the JSON payload to use a here-document
block for clearer and safer JSON formatting.

@grahamking

Copy link
Copy Markdown
Contributor

@ptarasiewiczNV Should we revive this? Seems useful. Otherwise can you close it?

@grahamking grahamking closed this Aug 18, 2025
@ptarasiewiczNV
ptarasiewiczNV deleted the ptarasiewicz/move-tests-to-dynamo branch January 14, 2026 15:38
ywang96 pushed a commit to ywang96/dynamo that referenced this pull request Sep 17, 2026
## Summary

- add an opt-in Redis Cluster/Dragonfly cache for encoded multimodal image bytes
- retain the existing per-worker decoded-image LRU and in-flight deduplication
- fail open to the origin when shared-cache reads, writes, or deletes fail
- validate cached payloads, evict corrupt entries, and refill them from the origin
- split Redis connection and I/O timeouts for large image transfers
- expose shared-cache GET and SET latency histograms through the existing image-loader metrics registry

The cache is disabled by default. It is enabled with `DYN_MM_SHARED_IMAGE_CACHE_ENABLED=1` and configured through `DYN_MM_SHARED_IMAGE_CACHE_URL`, TTL, connect-timeout, and I/O-timeout environment variables. No distributed lock is introduced because this workload does not require cache-stampede protection.

## Metrics

- `dynamo_component_image_shared_cache_get_duration_seconds` with bounded outcomes `hit`, `miss`, and `error`
- `dynamo_component_image_shared_cache_set_duration_seconds` with bounded outcomes `success` and `error`
- both histograms use 1 ms–4 s latency buckets and a bounded `size_bucket` label: `le_64kib`, `le_256kib`, `le_1mib`, `le_4mib`, `le_16mib`, `le_32mib`, `gt_32mib`, or `unknown`

GET misses/errors use `size_bucket="unknown"`; SET errors retain the attempted payload size class. Metrics use the image loader's dedicated Prometheus registry to preserve Dynamo's multiprocess initialization order. URLs and cache keys are never used as labels.

## User impact

Workers can share compressed image payloads through a cluster-aware redis-py client, reducing repeated blobproxy/origin downloads across replicas. Existing deployments behave as before unless the feature flag is enabled.

## Validation

- 53 image-loader and metrics tests passed; one expected HEIF test skipped because test-only encoding support is not installed
- Python compilation passed
- isort, Black, flake8, Ruff, and codespell passed for the cache changes
- `git diff --check` passed

The repository-wide pytest marker report remains blocked by a pre-existing collection error in `test_vllm_processor_unit.py` where `request` is used as a parametrized argument.

Ported from Inferact/dynamo#261 to ai-dynamo/dynamo main.

Signed-off-by: Dao Le <daole@inferact.ai>
ywang96 pushed a commit to ywang96/dynamo that referenced this pull request Sep 17, 2026
Signed-off-by: Dao Le <daole@inferact.ai>

## Summary

- read `x-session-affinity` at the Rust HTTP boundary and propagate it through both agent context and router session affinity
- pass the propagated session ID into the vLLM image loader
- scope local decoded-image LRU entries, in-flight fetch deduplication, and Dragonfly encoded-image entries by a hashed session identifier
- gate session scoping behind `DYN_MM_IMAGE_CACHE_SESSION_SCOPED=1` (default off); when enabled without a valid session scope, bypass image caches

This was originally stacked on ai-dynamo#261. Now that ai-dynamo#261 is merged, this PR targets `kimi-dev`.

## Validation

- `cargo test -p dynamo-llm --no-default-features session_affinity_ --lib` (35 passed)
- targeted agent-context/header tests (4 passed)
- ImageLoader unit tests (50 passed, 1 expected HEIF skip)
- Black, isort, Ruff, codespell, targeted rustfmt, Python compile, and `git diff --check`
- vLLM request-processor runtime tests were not run locally because vLLM is unavailable on macOS; the modified module and tests compile successfully

Ported from Inferact/dynamo#264 to ai-dynamo/dynamo main.
ywang96 pushed a commit to ywang96/dynamo that referenced this pull request Sep 17, 2026
## Summary

- add an opt-in Redis Cluster/Dragonfly cache for encoded multimodal image bytes
- retain the existing per-worker decoded-image LRU and in-flight deduplication
- fail open to the origin when shared-cache reads, writes, or deletes fail
- validate cached payloads, evict corrupt entries, and refill them from the origin
- split Redis connection and I/O timeouts for large image transfers
- expose shared-cache GET and SET latency histograms through the existing image-loader metrics registry

The cache is disabled by default. It is enabled with `DYN_MM_SHARED_IMAGE_CACHE_ENABLED=1` and configured through `DYN_MM_SHARED_IMAGE_CACHE_URL`, TTL, connect-timeout, and I/O-timeout environment variables. No distributed lock is introduced because this workload does not require cache-stampede protection.

## Metrics

- `dynamo_component_image_shared_cache_get_duration_seconds` with bounded outcomes `hit`, `miss`, and `error`
- `dynamo_component_image_shared_cache_set_duration_seconds` with bounded outcomes `success` and `error`
- both histograms use 1 ms–4 s latency buckets and a bounded `size_bucket` label: `le_64kib`, `le_256kib`, `le_1mib`, `le_4mib`, `le_16mib`, `le_32mib`, `gt_32mib`, or `unknown`

GET misses/errors use `size_bucket="unknown"`; SET errors retain the attempted payload size class. Metrics use the image loader's dedicated Prometheus registry to preserve Dynamo's multiprocess initialization order. URLs and cache keys are never used as labels.

## User impact

Workers can share compressed image payloads through a cluster-aware redis-py client, reducing repeated blobproxy/origin downloads across replicas. Existing deployments behave as before unless the feature flag is enabled.

## Validation

- 53 image-loader and metrics tests passed; one expected HEIF test skipped because test-only encoding support is not installed
- Python compilation passed
- isort, Black, flake8, Ruff, and codespell passed for the cache changes
- `git diff --check` passed

The repository-wide pytest marker report remains blocked by a pre-existing collection error in `test_vllm_processor_unit.py` where `request` is used as a parametrized argument.

Ported from Inferact/dynamo#261 to ai-dynamo/dynamo main.

Signed-off-by: Dao Le <daole@inferact.ai>

Signed-off-by: Dao007forever <daole@inferact.ai>
ywang96 pushed a commit to ywang96/dynamo that referenced this pull request Sep 17, 2026
Signed-off-by: Dao Le <daole@inferact.ai>

## Summary

- read `x-session-affinity` at the Rust HTTP boundary and propagate it through both agent context and router session affinity
- pass the propagated session ID into the vLLM image loader
- scope local decoded-image LRU entries, in-flight fetch deduplication, and Dragonfly encoded-image entries by a hashed session identifier
- gate session scoping behind `DYN_MM_IMAGE_CACHE_SESSION_SCOPED=1` (default off); when enabled without a valid session scope, bypass image caches

This was originally stacked on ai-dynamo#261. Now that ai-dynamo#261 is merged, this PR targets `kimi-dev`.

## Validation

- `cargo test -p dynamo-llm --no-default-features session_affinity_ --lib` (35 passed)
- targeted agent-context/header tests (4 passed)
- ImageLoader unit tests (50 passed, 1 expected HEIF skip)
- Black, isort, Ruff, codespell, targeted rustfmt, Python compile, and `git diff --check`
- vLLM request-processor runtime tests were not run locally because vLLM is unavailable on macOS; the modified module and tests compile successfully

Ported from Inferact/dynamo#264 to ai-dynamo/dynamo main.

Signed-off-by: Dao007forever <daole@inferact.ai>
furionw pushed a commit to ywang96/dynamo that referenced this pull request Sep 23, 2026
- add an opt-in Redis Cluster/Dragonfly cache for encoded multimodal image bytes
- retain the existing per-worker decoded-image LRU and in-flight deduplication
- fail open to the origin when shared-cache reads, writes, or deletes fail
- validate cached payloads, evict corrupt entries, and refill them from the origin
- split Redis connection and I/O timeouts for large image transfers
- expose shared-cache GET and SET latency histograms through the existing image-loader metrics registry

The cache is disabled by default. It is enabled with `DYN_MM_SHARED_IMAGE_CACHE_ENABLED=1` and configured through `DYN_MM_SHARED_IMAGE_CACHE_URL`, TTL, connect-timeout, and I/O-timeout environment variables. No distributed lock is introduced because this workload does not require cache-stampede protection.

- `dynamo_component_image_shared_cache_get_duration_seconds` with bounded outcomes `hit`, `miss`, and `error`
- `dynamo_component_image_shared_cache_set_duration_seconds` with bounded outcomes `success` and `error`
- both histograms use 1 ms–4 s latency buckets and a bounded `size_bucket` label: `le_64kib`, `le_256kib`, `le_1mib`, `le_4mib`, `le_16mib`, `le_32mib`, `gt_32mib`, or `unknown`

GET misses/errors use `size_bucket="unknown"`; SET errors retain the attempted payload size class. Metrics use the image loader's dedicated Prometheus registry to preserve Dynamo's multiprocess initialization order. URLs and cache keys are never used as labels.

Workers can share compressed image payloads through a cluster-aware redis-py client, reducing repeated blobproxy/origin downloads across replicas. Existing deployments behave as before unless the feature flag is enabled.

- 53 image-loader and metrics tests passed; one expected HEIF test skipped because test-only encoding support is not installed
- Python compilation passed
- isort, Black, flake8, Ruff, and codespell passed for the cache changes
- `git diff --check` passed

The repository-wide pytest marker report remains blocked by a pre-existing collection error in `test_vllm_processor_unit.py` where `request` is used as a parametrized argument.

Ported from Inferact/dynamo#261 to ai-dynamo/dynamo main.

Signed-off-by: Dao Le <daole@inferact.ai>

Signed-off-by: Dao007forever <daole@inferact.ai>
furionw pushed a commit to ywang96/dynamo that referenced this pull request Sep 23, 2026
Signed-off-by: Dao Le <daole@inferact.ai>

- read `x-session-affinity` at the Rust HTTP boundary and propagate it through both agent context and router session affinity
- pass the propagated session ID into the vLLM image loader
- scope local decoded-image LRU entries, in-flight fetch deduplication, and Dragonfly encoded-image entries by a hashed session identifier
- gate session scoping behind `DYN_MM_IMAGE_CACHE_SESSION_SCOPED=1` (default off); when enabled without a valid session scope, bypass image caches

This was originally stacked on ai-dynamo#261. Now that ai-dynamo#261 is merged, this PR targets `kimi-dev`.

- `cargo test -p dynamo-llm --no-default-features session_affinity_ --lib` (35 passed)
- targeted agent-context/header tests (4 passed)
- ImageLoader unit tests (50 passed, 1 expected HEIF skip)
- Black, isort, Ruff, codespell, targeted rustfmt, Python compile, and `git diff --check`
- vLLM request-processor runtime tests were not run locally because vLLM is unavailable on macOS; the modified module and tests compile successfully

Ported from Inferact/dynamo#264 to ai-dynamo/dynamo main.

Signed-off-by: Dao007forever <daole@inferact.ai>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants