Skip to content

Conversation

@biswapanda
Copy link
Contributor

@biswapanda biswapanda commented Jul 23, 2025

Overview:

  1. Fix sglang local launch scripts
  2. Add sglang k8s deploy yamls

Todo

  1. health check across all backends will be added in upcoming PRs
  2. disagg/router examples will be added in upcoming PRs after testing

closes:
linear: DYN-750
linear: DYN-751

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

  • New Features

    • Introduced a new deployment configuration for the aggregation backend, including frontend and worker services with resource and probe settings.
  • Bug Fixes

    • Corrected shell script syntax in launch scripts to ensure proper command execution.

@biswapanda biswapanda self-assigned this Jul 23, 2025
@github-actions github-actions bot added the fix label Jul 23, 2025
@biswapanda biswapanda requested review from grahamking and ishandhanani and removed request for grahamking July 23, 2025 08:37
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jul 23, 2025

Walkthrough

This update introduces a new Kubernetes deployment YAML for the sglang backend, defining both frontend and decode worker services with detailed resource and probe configurations. Additionally, it corrects shell script syntax in two launch scripts by removing unnecessary trailing backslashes from the last argument lines in multi-line Python command invocations.

Changes

File(s) Change Summary
components/backends/sglang/deploy/agg.yaml Added new DynamoGraphDeployment YAML for sglang-agg with Frontend and SGLangDecodeWorker services.
components/backends/sglang/launch/agg.sh
components/backends/sglang/launch/agg_router.sh
Fixed shell script syntax by removing trailing backslash from last argument in Python command lines.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Frontend (Pod)
    participant SGLangDecodeWorker (Pod)
    User->>Frontend (Pod): HTTP request
    Frontend (Pod)->>SGLangDecodeWorker (Pod): Model decode request
    SGLangDecodeWorker (Pod)-->>Frontend (Pod): Decoded response
    Frontend (Pod)-->>User: Response
Loading

Estimated code review effort

2 (~12 minutes)

Possibly related PRs

Poem

In YAML fields and shell so neat,
A rabbit hops with nimble feet.
Frontend and worker, side by side,
In pods they now reside.
No more stray backslashes to rue—
Deployments crisp, commands anew!
🐇✨


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 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.

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.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🔭 Outside diff range comments (2)
components/backends/sglang/launch/agg.sh (1)

1-13: Harden the script with set -euo pipefail.

The launch script controls backend services; silent failures will be painful to debug. Add the standard safety flags right after the shebang so the script aborts on any error, undefined variable or failed pipe.

 #!/bin/bash
+# Fail fast and propagate non-zero exit codes
+set -euo pipefail
components/backends/sglang/launch/agg_router.sh (1)

1-13: Replicate safety flags from agg.sh.

For consistency and robustness, add set -euo pipefail to this script as well.

 #!/bin/bash
+# Abort on error, undefined var or pipe failure
+set -euo pipefail
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2c642fd and 1d4ae1c.

📒 Files selected for processing (3)
  • components/backends/sglang/deploy/agg.yaml (1 hunks)
  • components/backends/sglang/launch/agg.sh (1 hunks)
  • components/backends/sglang/launch/agg_router.sh (1 hunks)
🧠 Learnings (2)
📓 Common learnings
Learnt from: fsaady
PR: ai-dynamo/dynamo#1730
File: examples/sglang/slurm_jobs/scripts/worker_setup.py:230-244
Timestamp: 2025-07-03T10:14:30.570Z
Learning: In examples/sglang/slurm_jobs/scripts/worker_setup.py, background processes (like nats-server, etcd) are intentionally left running even if later processes fail. This design choice allows users to manually connect to nodes and debug issues without having to restart the entire SLURM job from scratch, providing operational flexibility for troubleshooting in cluster environments.
components/backends/sglang/deploy/agg.yaml (3)

Learnt from: julienmancuso
PR: #2012
File: deploy/cloud/helm/crds/templates/nvidia.com_dynamocomponentdeployments.yaml:1178-1180
Timestamp: 2025-07-18T16:05:05.482Z
Learning: The stopSignal field under lifecycle in DynamoComponentDeployment CRDs is autogenerated due to Kubernetes library upgrades (k8s.io/api and k8s.io/apimachinery from v0.32.3 to v0.33.1), not a manual design decision by the user.

Learnt from: julienmancuso
PR: #2012
File: deploy/cloud/helm/crds/templates/nvidia.com_dynamographdeployments.yaml:1233-1235
Timestamp: 2025-07-18T16:04:47.445Z
Learning: The stopSignal field in Kubernetes CRDs like DynamoGraphDeployment and DynamoComponentDeployment is autogenerated by controller-gen when upgrading Kubernetes library versions, and represents expected upstream API changes rather than manual code that needs custom validation.

Learnt from: julienmancuso
PR: #2012
File: deploy/cloud/helm/crds/templates/nvidia.com_dynamocomponentdeployments.yaml:92-98
Timestamp: 2025-07-18T16:04:31.743Z
Learning: CRD schemas in files like deploy/cloud/helm/crds/templates/*.yaml are auto-generated from Kubernetes library upgrades and should not be manually modified as changes would be overwritten during regeneration.

🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: fsaady
PR: ai-dynamo/dynamo#1730
File: examples/sglang/slurm_jobs/scripts/worker_setup.py:230-244
Timestamp: 2025-07-03T10:14:30.570Z
Learning: In examples/sglang/slurm_jobs/scripts/worker_setup.py, background processes (like nats-server, etcd) are intentionally left running even if later processes fail. This design choice allows users to manually connect to nodes and debug issues without having to restart the entire SLURM job from scratch, providing operational flexibility for troubleshooting in cluster environments.
components/backends/sglang/deploy/agg.yaml (3)

Learnt from: julienmancuso
PR: #2012
File: deploy/cloud/helm/crds/templates/nvidia.com_dynamocomponentdeployments.yaml:1178-1180
Timestamp: 2025-07-18T16:05:05.482Z
Learning: The stopSignal field under lifecycle in DynamoComponentDeployment CRDs is autogenerated due to Kubernetes library upgrades (k8s.io/api and k8s.io/apimachinery from v0.32.3 to v0.33.1), not a manual design decision by the user.

Learnt from: julienmancuso
PR: #2012
File: deploy/cloud/helm/crds/templates/nvidia.com_dynamographdeployments.yaml:1233-1235
Timestamp: 2025-07-18T16:04:47.445Z
Learning: The stopSignal field in Kubernetes CRDs like DynamoGraphDeployment and DynamoComponentDeployment is autogenerated by controller-gen when upgrading Kubernetes library versions, and represents expected upstream API changes rather than manual code that needs custom validation.

Learnt from: julienmancuso
PR: #2012
File: deploy/cloud/helm/crds/templates/nvidia.com_dynamocomponentdeployments.yaml:92-98
Timestamp: 2025-07-18T16:04:31.743Z
Learning: CRD schemas in files like deploy/cloud/helm/crds/templates/*.yaml are auto-generated from Kubernetes library upgrades and should not be manually modified as changes would be overwritten during regeneration.

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: pre-merge-rust (lib/runtime/examples)
  • GitHub Check: pre-merge-rust (.)
  • GitHub Check: pre-merge-rust (lib/bindings/python)
  • GitHub Check: Build and Test - vllm
🔇 Additional comments (4)
components/backends/sglang/launch/agg.sh (1)

22-29: Trailing back-slash removal is correct and prevents an unterminated command.
Nothing further required for this line.

components/backends/sglang/launch/agg_router.sh (1)

22-29: Back-slash removal fixes the shell syntax—LGTM.

components/backends/sglang/deploy/agg.yaml (2)

67-74: Namespace mismatch might cause cross-talk.

dynamoNamespace is sglang-agg, but both launch scripts and the frontend container clear the namespace dynamo. Verify this is intentional; otherwise messages from distinct deployments could collide.


71-78: Non-standard GPU resource key.

Kubernetes default for NVIDIA GPUs is nvidia.com/gpu.
If your CRD doesn’t translate gpu: automatically, scheduling will fail.

Copy link
Contributor

@ishandhanani ishandhanani left a comment

Choose a reason for hiding this comment

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

Do you think you can launch the sgl http server in the background biswa? On maybe the head node?

After I add the engine specific health endpoint we can use it for health and in the future readiness

@ishandhanani
Copy link
Contributor

Do you think you can launch the sgl http server in the background biswa? On maybe the head node?

After I add the engine specific health endpoint we can use it for health and in the future readiness

You can find an example of this in the dsr1 wide ep guide

@grahamking
Copy link
Contributor

Nit: It shouldn't be fix in the title because most of the PR is adding a new yaml. Otherwise LGTM.

@biswapanda biswapanda changed the title fix: sglang examples launch and deploy feat: sglang examples launch and deploy Jul 23, 2025
@github-actions github-actions bot added feat and removed fix labels Jul 23, 2025
@copy-pr-bot
Copy link

copy-pr-bot bot commented Jul 23, 2025

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.

@pull-request-size pull-request-size bot added size/L and removed size/M labels Jul 23, 2025
@biswapanda biswapanda enabled auto-merge (squash) July 23, 2025 19:48
@biswapanda biswapanda merged commit 13560ab into main Jul 23, 2025
10 checks passed
@biswapanda biswapanda deleted the bis/sgl-examples branch July 23, 2025 21:22
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.

5 participants