Skip to content

Conversation

@alec-flowers
Copy link
Contributor

@alec-flowers alec-flowers commented Jul 12, 2025

Overview:

Fixes: https://nvbugspro.nvidia.com/bug/5385756

Summary by CodeRabbit

  • New Features
    • Added automatic detection of the shared library path for improved configuration flexibility.
  • Improvements
    • Environment variable for the shared library path is now dynamically set, reducing the need for manual updates.
  • Chores
    • Updated packaging process to ensure required shared libraries are included in build outputs.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jul 12, 2025

Walkthrough

A new utility function, get_capi_library_path, was introduced to dynamically resolve the path to the libdynamo_llm_capi.so shared library, using either an environment variable or a default location. This function is now exported by the dynamo.sdk package and used in place of hardcoded paths. Build and environment setup scripts were updated accordingly.

Changes

File(s) Change Summary
deploy/sdk/src/dynamo/sdk/lib/utils.py Added get_capi_library_path() utility function to resolve the shared library path.
deploy/sdk/src/dynamo/sdk/init.py Imported and exported get_capi_library_path via __all__.
launch/dynamo-run/src/subprocess/vllm_inc.py Replaced hardcoded library path with dynamic call to get_capi_library_path() for env var setup.
hatch_build.py Updated build script to force-include libdynamo_llm_capi.so from the correct source path.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant vllm_inc.py
    participant dynamo.sdk.lib.utils
    participant OS

    User->>vllm_inc.py: Start vLLM worker
    vllm_inc.py->>dynamo.sdk.lib.utils: get_capi_library_path()
    dynamo.sdk.lib.utils->>OS: Check VLLM_KV_CAPI_PATH env var
    alt Env var set
        dynamo.sdk.lib.utils-->>vllm_inc.py: Return env var path
    else Env var not set
        dynamo.sdk.lib.utils->>OS: Locate default library path
        dynamo.sdk.lib.utils-->>vllm_inc.py: Return default path
    end
    vllm_inc.py->>OS: Set VLLM_KV_CAPI_PATH env var
Loading

Poem

In the warren where code bunnies hop,
We found a new way to find our shared .so atop!
No more hardcoded trails,
Dynamic paths now set our sails.
With every build and subprocess run,
Our library’s found—mission done!
🐇✨


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 35c5606 and 4e4ccc6.

📒 Files selected for processing (4)
  • deploy/sdk/src/dynamo/sdk/__init__.py (2 hunks)
  • deploy/sdk/src/dynamo/sdk/lib/utils.py (1 hunks)
  • hatch_build.py (1 hunks)
  • launch/dynamo-run/src/subprocess/vllm_inc.py (2 hunks)
🧰 Additional context used
🧠 Learnings (1)
launch/dynamo-run/src/subprocess/vllm_inc.py (2)
Learnt from: nnshah1
PR: ai-dynamo/dynamo#1444
File: tests/fault_tolerance/utils/metrics.py:30-32
Timestamp: 2025-07-01T13:55:03.940Z
Learning: The `@dynamo_worker()` decorator in the dynamo codebase returns a wrapper that automatically injects the `runtime` parameter before calling the wrapped function. This means callers only need to provide the non-runtime parameters, while the decorator handles injecting the runtime argument automatically. For example, a function with signature `async def get_metrics(runtime, log_dir)` decorated with `@dynamo_worker()` can be called as `get_metrics(log_dir)` because the decorator wrapper injects the runtime parameter.
Learnt from: GuanLuo
PR: ai-dynamo/dynamo#1371
File: examples/llm/benchmarks/vllm_multinode_setup.sh:18-25
Timestamp: 2025-06-05T01:46:15.509Z
Learning: In multi-node setups with head/worker architecture, the head node typically doesn't need environment variables pointing to its own services (like NATS_SERVER, ETCD_ENDPOINTS) because local processes can access them via localhost. Only worker nodes need these environment variables to connect to the head node's external IP address.
🧬 Code Graph Analysis (2)
deploy/sdk/src/dynamo/sdk/__init__.py (1)
deploy/sdk/src/dynamo/sdk/lib/utils.py (1)
  • get_capi_library_path (137-159)
launch/dynamo-run/src/subprocess/vllm_inc.py (1)
deploy/sdk/src/dynamo/sdk/lib/utils.py (1)
  • get_capi_library_path (137-159)
⏰ 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). (5)
  • GitHub Check: Mirror Repository to GitLab
  • GitHub Check: Build and Test - vllm
  • GitHub Check: pre-merge-rust (lib/bindings/python)
  • GitHub Check: pre-merge-rust (.)
  • GitHub Check: pre-merge-rust (lib/runtime/examples)
🔇 Additional comments (3)
hatch_build.py (1)

31-31: LGTM! Ensures library is included in the wheel.

The mapping correctly includes the shared library in the build output at the expected location that aligns with the utility function's fallback path.

deploy/sdk/src/dynamo/sdk/__init__.py (1)

26-26: LGTM! Properly exposes the new utility function.

The import and export follow standard Python patterns for making the new functionality available as part of the public API.

Also applies to: 43-43

launch/dynamo-run/src/subprocess/vllm_inc.py (1)

39-39: LGTM! Import follows existing patterns.

The import is correctly placed and follows the file's import organization.

@alec-flowers alec-flowers enabled auto-merge (squash) July 12, 2025 06:22
@alec-flowers alec-flowers merged commit 30e5c35 into main Jul 12, 2025
13 of 15 checks passed
@alec-flowers alec-flowers deleted the aflowers/fix-capi branch July 12, 2025 06:52
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.

3 participants