Skip to content

Conversation

@biswapanda
Copy link
Contributor

@biswapanda biswapanda commented Sep 16, 2025

Overview:

We have hard coded dynamo namespaces in examples.

Replace them with env var DYN_NAMESPACE

closes:

Summary by CodeRabbit

  • New Features
    • Default Dynamo endpoints are now configurable via the DYN_NAMESPACE environment variable across backends (llama.cpp, sglang, vLLM) and examples (hello_world, multimodal processor/encoder/video).
    • Set DYN_NAMESPACE to route requests to a custom namespace; if unset, it defaults to “dynamo”.
    • CLI help and inferred defaults now reflect the selected namespace; no changes required for existing setups and no API behavior altered beyond default values.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Sep 16, 2025

Walkthrough

Introduces an environment-driven namespace (DYN_NAMESPACE) to construct default Dynamo endpoints across multiple modules and examples. Replaces hard-coded dyn://dynamo... defaults with dyn://{DYN_NAMESPACE}.... Downstream defaults are updated where applicable. No changes to argument parsing APIs or runtime logic beyond default value computation.

Changes

Cohort / File(s) Summary of changes
Backend default endpoint (llama_cpp, sglang)
components/backends/llama_cpp/src/dynamo/llama_cpp/main.py, components/backends/sglang/src/dynamo/sglang/args.py
Add DYN_NAMESPACE = os.environ.get("DYN_NAMESPACE", "dynamo"). Update DEFAULT_ENDPOINT to f"dyn://{DYN_NAMESPACE}.backend.generate".
Multimodal components defaults
examples/multimodal/components/encode_worker.py, examples/multimodal/components/processor.py, examples/multimodal/components/video_encode_worker.py
Read DYN_NAMESPACE from env. Set component DEFAULT_ENDPOINT to `dyn://{DYN_NAMESPACE}.(encoder
Multimodal utils
examples/multimodal/utils/args.py
Add DYN_NAMESPACE env default. Update DEFAULT_ENDPOINT to dyn://{DYN_NAMESPACE}.backend.generate.
Python hello_world servers
lib/bindings/python/examples/hello_world/server_sglang.py, .../server_sglang_static.py, .../server_sglang_tok.py, .../server_vllm.py
Import os. Add DYN_NAMESPACE from env. Change DEFAULT_ENDPOINT from fixed dyn://dynamo.backend.generate to dyn://{DYN_NAMESPACE}.backend.generate.

Sequence Diagram(s)

sequenceDiagram
    autonumber
    actor User
    participant Env as Environment
    participant App as CLI/App
    participant Parser as Args Parser

    User->>App: Run without --endpoint
    App->>Env: Read DYN_NAMESPACE (default "dynamo")
    Env-->>App: Namespace value
    App->>Parser: Request defaults
    Parser-->>App: Build endpoint: dyn://{DYN_NAMESPACE}.<service>.generate
    App-->>User: Use computed default endpoint
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Poem

In burrows of code, I flip a switch,
From hard-wired paths to names that twitch.
The breeze says “DYN,” I hop along—
Endpoints hum a fresher song.
Toggle the env, watch routes realign—
Carrots for configs, crisp and fine. 🥕✨

Tip

👮 Agentic pre-merge checks are now available in preview!

Pro plan users can now enable pre-merge checks in their settings to enforce checklists before merging PRs.

  • Built-in checks – Quickly apply ready-made checks to enforce title conventions, require pull request descriptions that follow templates, validate linked issues for compliance, and more.
  • Custom agentic checks – Define your own rules using CodeRabbit’s advanced agentic capabilities to enforce organization-specific policies and workflows. For example, you can instruct CodeRabbit’s agent to verify that API documentation is updated whenever API schema files are modified in a PR. Note: Upto 5 custom checks are currently allowed during the preview period. Pricing for this feature will be announced in a few weeks.

Please see the documentation for more information.

Example:

reviews:
  pre_merge_checks:
    custom_checks:
      - name: "Undocumented Breaking Changes"
        mode: "warning"
        instructions: |
          Pass/fail criteria: All breaking changes to public APIs, CLI flags, environment variables, configuration keys, database schemas, or HTTP/GraphQL endpoints must be documented in the "Breaking Change" section of the PR description and in CHANGELOG.md. Exclude purely internal or private changes (e.g., code not exported from package entry points or explicitly marked as internal).

Please share your feedback with us on this Discord post.


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

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

Pre-merge checks

❌ Failed checks (1 warning, 1 inconclusive)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
Description Check ❓ Inconclusive The PR includes a brief Overview and correctly references the NV bug and a linear ticket, but it does not follow the repository's required description template: the "Details" and "Where should the reviewer start?" sections are missing and the "Related Issues" formatting is not aligned with the template. Because the description is very concise and lacks file-level change summaries, testing instructions, and reviewer guidance, it is too vague to support a thorough review. Therefore the check is inconclusive. Please update the PR description to follow the repository template by adding a "Details" section that summarizes the specific file and behavioral changes, a "Where should the reviewer start?" section listing key files or entry points to review, and a "Related Issues" block using action keywords; also include any testing steps, compatibility or release impact notes. After those additions are made, re-run the pre-merge checks so the description can be re-evaluated.
✅ Passed checks (1 passed)
Check name Status Explanation
Title Check ✅ Passed The title "fix: replace hard coded dynamo namespace with env var" is concise, single-sentence, and accurately summarizes the primary change in the PR — replacing hard-coded "dynamo" namespace with an environment variable (DYN_NAMESPACE) across examples and components; it directly reflects the changes in the provided summary. The phrasing is clear and relevant for a teammate scanning history.

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: 4

🧹 Nitpick comments (2)
lib/bindings/python/examples/hello_world/server_sglang_static.py (1)

16-26: LGTM — dynamic endpoint default added. Minor doc tweak suggested.

The inline usage comment still shows dyn://dynamo.backend.generate. Consider changing it to dyn://$DYN_NAMESPACE.backend.generate (or “dyn://...”) to avoid confusion.

components/backends/sglang/src/dynamo/sglang/args.py (1)

153-154: Avoid duplicate env reads; use the module-level DYN_NAMESPACE.

-    namespace = os.environ.get("DYN_NAMESPACE", "dynamo")
+    namespace = DYN_NAMESPACE

Multiple other files also read DYN_NAMESPACE directly (examples/multimodal/, lib/bindings/python/examples/, components/backends//src/dynamo/); consider unifying them repo-wide for consistency.

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b1186ae and b9a4298.

📒 Files selected for processing (10)
  • components/backends/llama_cpp/src/dynamo/llama_cpp/main.py (2 hunks)
  • components/backends/sglang/src/dynamo/sglang/args.py (1 hunks)
  • examples/multimodal/components/encode_worker.py (1 hunks)
  • examples/multimodal/components/processor.py (1 hunks)
  • examples/multimodal/components/video_encode_worker.py (1 hunks)
  • examples/multimodal/utils/args.py (1 hunks)
  • lib/bindings/python/examples/hello_world/server_sglang.py (2 hunks)
  • lib/bindings/python/examples/hello_world/server_sglang_static.py (2 hunks)
  • lib/bindings/python/examples/hello_world/server_sglang_tok.py (2 hunks)
  • lib/bindings/python/examples/hello_world/server_vllm.py (2 hunks)
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-07-01T13:55:03.940Z
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.

Applied to files:

  • lib/bindings/python/examples/hello_world/server_sglang_static.py
⏰ 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 - dynamo
🔇 Additional comments (7)
examples/multimodal/components/video_encode_worker.py (1)

220-223: LGTM — defaults now namespace-aware.

Dynamic defaults for both endpoint and downstream-endpoint look correct and consistent with the PR intent.

examples/multimodal/components/encode_worker.py (1)

179-182: LGTM — endpoint defaults derive from DYN_NAMESPACE.

Matches the pattern used elsewhere; no issues spotted.

examples/multimodal/utils/args.py (1)

32-34: LGTM — centralized DEFAULT_ENDPOINT is namespace-aware.

No functional concerns.

lib/bindings/python/examples/hello_world/server_sglang_tok.py (1)

25-25: LGTM — endpoint default is now tied to DYN_NAMESPACE.

Change is minimal and consistent.

Also applies to: 38-39

components/backends/llama_cpp/src/dynamo/llama_cpp/main.py (1)

8-8: LGTM — backend default endpoint now respects DYN_NAMESPACE.

Matches other backends/examples; no issues.

Also applies to: 21-22

lib/bindings/python/examples/hello_world/server_sglang.py (1)

24-24: LGTM — environment-driven default endpoint.

Consistent with the rest of the PR.

Also applies to: 34-35

lib/bindings/python/examples/hello_world/server_vllm.py (1)

32-32: Import addition looks good.

os is required for the env var; no issues.

@copy-pr-bot
Copy link

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

@biswapanda biswapanda force-pushed the bis/fix-hardcoded-dyn-ns branch from c4d8318 to eaa423a Compare September 16, 2025 05:14
@biswapanda biswapanda force-pushed the bis/fix-hardcoded-dyn-ns branch 2 times, most recently from 8463d2e to 25683ac Compare September 16, 2025 05:14
Signed-off-by: Biswa Panda <biswa.panda@gmail.com>
@biswapanda
Copy link
Contributor Author

/ok to test 7736826

Copy link
Contributor

@indrajit96 indrajit96 left a comment

Choose a reason for hiding this comment

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

LGTM!

@biswapanda biswapanda merged commit 960dc89 into main Sep 16, 2025
12 of 13 checks passed
@biswapanda biswapanda deleted the bis/fix-hardcoded-dyn-ns branch September 16, 2025 21:56
biswapanda added a commit that referenced this pull request Sep 16, 2025
Signed-off-by: Biswa Panda <biswa.panda@gmail.com>
saturley-hall pushed a commit that referenced this pull request Sep 16, 2025
Signed-off-by: Biswa Panda <biswa.panda@gmail.com>
kmkelle-nv pushed a commit that referenced this pull request Sep 17, 2025
Signed-off-by: Biswa Panda <biswa.panda@gmail.com>
Signed-off-by: Kristen Kelleher <kkelleher@nvidia.com>
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.

6 participants