Skip to content

Conversation

ishandhanani
Copy link
Contributor

@ishandhanani ishandhanani commented Jul 7, 2025

This PR adds in the h100 and gb200 large scale disagg + wide ep SGLang commands detailed in sgl-project/sglang#6017 and sgl-project/sglang#7227. The goal here is to be able to use the same slurm script to collect benchmarking numbers on sglang and dynamo

Summary by CodeRabbit

  • New Features
    • Added support for running worker setup using SGLang servers as an alternative to the existing setup.
    • Introduced a new command-line flag (--use-sglang-commands) to enable the SGLang-based mode.
    • Worker setup now dynamically chooses between Dynamo and SGLang modes based on the selected flag, with appropriate logging for each mode.

Copy link

copy-pr-bot bot commented Jul 7, 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.

@github-actions github-actions bot added the feat label Jul 7, 2025
@ishandhanani ishandhanani changed the title feat: add sglang commands to slurm feat: add sglang server commands to slurm Jul 7, 2025
Copy link
Contributor

coderabbitai bot commented Jul 7, 2025

Walkthrough

The script for SLURM job worker setup was updated to support an alternative SGLang-based execution mode, toggled by a new --use-sglang-commands flag. Functions for prefill and decode node setup now conditionally generate and execute SGLang or Dynamo commands based on this flag, while preserving the original Dynamo-based workflow.

Changes

File(s) Change Summary
examples/sglang/slurm_jobs/scripts/worker_setup.py Added --use-sglang-commands CLI flag; updated node setup functions to support SGLang mode; conditionally run SGLang or Dynamo commands; refactored argument parsing and logging.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant WorkerSetupScript
    participant SGLangServer
    participant DynamoWorker
    participant NatsEtcd
    participant SGLangLB

    User->>WorkerSetupScript: Run with/without --use-sglang-commands
    alt use_sglang_commands = true
        WorkerSetupScript->>SGLangLB: (decode node only) Launch mini load balancer
        WorkerSetupScript->>SGLangServer: Launch SGLang server with arguments
    else use_sglang_commands = false
        WorkerSetupScript->>NatsEtcd: (prefill node, rank 0) Start nats-server and etcd
        WorkerSetupScript->>DynamoWorker: Launch Dynamo worker with arguments
    end
Loading

Possibly related PRs

Poem

In SLURM's warren, workers leap and bound,
Now SGLang joins the script, new pathways found!
With a flag, we hop between two lands,
Dynamo or SGLang—just as the job demands.
Rabbits rejoice, for options bloom anew,
In code and clusters, we always pursue! 🐇


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

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between b1509ea and be7e2b6.

📒 Files selected for processing (1)
  • examples/sglang/slurm_jobs/scripts/worker_setup.py (9 hunks)
🧰 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.538Z
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.
Learnt from: fsaady
PR: ai-dynamo/dynamo#1730
File: examples/sglang/slurm_jobs/job_script_template.j2:59-59
Timestamp: 2025-07-02T13:20:28.800Z
Learning: In the SLURM job script template at examples/sglang/slurm_jobs/job_script_template.j2, the `--total_nodes` parameter represents the total nodes per worker type (prefill or decode), not the total nodes in the entire cluster. Each worker type needs to know its own group size for distributed coordination.
Learnt from: fsaady
PR: ai-dynamo/dynamo#1730
File: examples/sglang/slurm_jobs/scripts/worker_setup.py:113-116
Timestamp: 2025-07-03T09:44:41.140Z
Learning: In examples/sglang/slurm_jobs/scripts/worker_setup.py, logging the full configuration file content is acceptable because the config file is public, contains only placeholder replacements (no sensitive data), and provides debugging benefits for users who may want to create configurations based on the logged output.
examples/sglang/slurm_jobs/scripts/worker_setup.py (4)
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.538Z
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.
Learnt from: fsaady
PR: ai-dynamo/dynamo#1730
File: examples/sglang/slurm_jobs/job_script_template.j2:59-59
Timestamp: 2025-07-02T13:20:28.800Z
Learning: In the SLURM job script template at examples/sglang/slurm_jobs/job_script_template.j2, the `--total_nodes` parameter represents the total nodes per worker type (prefill or decode), not the total nodes in the entire cluster. Each worker type needs to know its own group size for distributed coordination.
Learnt from: fsaady
PR: ai-dynamo/dynamo#1730
File: examples/sglang/slurm_jobs/scripts/worker_setup.py:113-116
Timestamp: 2025-07-03T09:44:41.140Z
Learning: In examples/sglang/slurm_jobs/scripts/worker_setup.py, logging the full configuration file content is acceptable because the config file is public, contains only placeholder replacements (no sensitive data), and provides debugging benefits for users who may want to create configurations based on the logged output.
Learnt from: nnshah1
PR: ai-dynamo/dynamo#1444
File: tests/fault_tolerance/configs/agg_tp_1_dp_8.yaml:31-38
Timestamp: 2025-07-01T15:33:53.262Z
Learning: In fault tolerance test configurations, the `resources` section under `ServiceArgs` specifies resources per individual worker, not total resources for all workers. So `workers: 8` with `gpu: '1'` means 8 workers × 1 GPU each = 8 GPUs total.
🪛 GitHub Actions: Pre Merge Validation of (ai-dynamo/dynamo/refs/pull/1804/merge) by ishandhanani.
examples/sglang/slurm_jobs/scripts/worker_setup.py

[error] 199-400: Black formatting check failed. The file was reformatted by the black hook. Run 'black --write examples/sglang/slurm_jobs/scripts/worker_setup.py' to fix code style issues.

⏰ 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). (1)
  • GitHub Check: Build and Test - vllm
🔇 Additional comments (5)
examples/sglang/slurm_jobs/scripts/worker_setup.py (5)

180-184: The command line argument implementation looks good.

The new --use-sglang-commands flag is properly defined with clear help text and follows standard argparse conventions.


290-305: Background process handling follows established patterns.

The SGLang mini load balancer is correctly started in the background using the existing run_command function, which is consistent with how other background processes are managed in this codebase.


244-274: Command construction logic is well-structured.

The dynamic command construction based on the use_sglang_commands flag is clean and maintains consistency between the two execution paths. The reuse of command arguments is efficient and reduces code duplication.

Also applies to: 306-335


202-203: Function signature updates are correct.

The addition of the use_sglang_commands parameter to both setup functions follows the existing patterns and maintains backward compatibility through the main function's argument parsing.

Also applies to: 283-284


362-362: Parameter passing and logging are properly implemented.

The new flag is correctly passed to both setup functions and appropriately logged for debugging purposes.

Also applies to: 371-371, 380-380

@pull-request-size pull-request-size bot added size/XL and removed size/L labels Jul 7, 2025
@ishandhanani ishandhanani changed the title feat: add sglang server commands to slurm feat: add gb200 and sglang commands to slurm scripts Jul 7, 2025
@ishandhanani ishandhanani requested review from whoisj, nealvaidya and a team as code owners July 31, 2025 17:44
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.

2 participants