Skip to content

Conversation

@biswapanda
Copy link
Contributor

@biswapanda biswapanda commented May 30, 2025

Overview:

  • service args should be resources (plural) not resource

Details:

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

  • Refactor
    • Renamed the field and related references from resource to resources for consistency across configuration and serialization.
    • Updated decorators and configuration parameters to use the new resources naming.
    • Simplified resource type coercion logic by leveraging automatic configuration, removing manual conversion methods.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented May 30, 2025

Walkthrough

The changes rename the resource field to resources across the service configuration classes and their usages, ensuring consistent terminology. Additionally, resource configuration now uses Pydantic's built-in type coercion for numeric fields instead of a manual validator. Example usage is updated to reflect the new field name.

Changes

File(s) Change Summary
deploy/sdk/src/dynamo/sdk/cli/build.py, examples/hello_world/hello_world.py Renamed resource field/argument to resources throughout service configuration and usage.
deploy/sdk/src/dynamo/sdk/core/protocol/interface.py Removed manual validator for gpu field; enabled Pydantic's coerce_numbers_to_str for resources.

Poem

In the garden of code, resources bloom,
No more a lone resource, but many in the room!
With numbers now strings, thanks to Pydantic’s might,
The rabbits rejoice, everything’s just right.
Hop, hop, hooray! The code’s in full tune,
Ready for launch, from morning till noon! 🐇


📜 Recent review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 7bb21ee and ac9f1f8.

📒 Files selected for processing (3)
  • deploy/sdk/src/dynamo/sdk/cli/build.py (3 hunks)
  • deploy/sdk/src/dynamo/sdk/core/protocol/interface.py (2 hunks)
  • examples/hello_world/hello_world.py (1 hunks)
🧰 Additional context used
🪛 Pylint (3.3.7)
deploy/sdk/src/dynamo/sdk/core/protocol/interface.py

[error] 22-22: Unable to import 'fastapi'

(E0401)


[error] 23-23: Unable to import 'pydantic'

(E0401)

⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Build and Test - vllm
🔇 Additional comments (6)
deploy/sdk/src/dynamo/sdk/core/protocol/interface.py (2)

20-23: LGTM! Improved import optimization.

The removal of unused Union import and addition of ConfigDict for the new Pydantic configuration is clean and appropriate.

🧰 Tools
🪛 Pylint (3.3.7)

[error] 22-22: Unable to import 'fastapi'

(E0401)


[error] 23-23: Unable to import 'pydantic'

(E0401)


62-63: Excellent refactor using Pydantic's built-in type coercion.

Replacing manual field validation with coerce_numbers_to_str=True is a much cleaner approach that leverages Pydantic's built-in capabilities. This automatically converts numeric values (cpu, gpu) to strings without requiring custom validator methods.

examples/hello_world/hello_world.py (1)

70-70:

Details

✅ Verification successful

Correct field name update to match new naming convention.

The change from resource to resources properly aligns with the updated field naming in the service configuration classes.

Since this is a breaking change, please verify that all occurrences of the old resource field name have been updated throughout the codebase:


🏁 Script executed:

#!/bin/bash
# Description: Search for any remaining usage of the old 'resource' field name that might have been missed
# Expected: Only legitimate uses of 'resource' that are not related to the renamed field

echo "Searching for potential missed 'resource' field usages..."
rg -i "resource\s*=" --type py -A 2 -B 2

echo -e "\nSearching for @service decorator usages with resource field..."
rg "@service\(" --type py -A 10 | rg -i "resource"

echo -e "\nSearching for ServiceConfig instantiations..."
ast-grep --pattern 'ServiceConfig($$$resource$$$)'

Length of output: 8210


Verification complete: resources used consistently

The migration from the old resource field to resources has been applied correctly across all service decorators and ServiceConfig instantiations. The only matches for resource = … are local variable assignments in tests (deploy/cloud/api-store/ai_dynamo_store/tests/test_utils.py) and API response construction (deploy/cloud/api-store/ai_dynamo_store/api/deployments.py), which do not pertain to the renamed field. No further changes are required.

deploy/sdk/src/dynamo/sdk/cli/build.py (3)

104-104: Correct field rename in ServiceConfig class definition.

The field rename from resource to resources aligns with the consistent naming convention being established across the codebase.


141-141: Consistent usage update in ServiceInfo.from_service method.

The assignment correctly uses the renamed resources field, maintaining consistency with the ServiceConfig class definition.


215-215: Proper serialization key update in manifest generation.

The serialization logic correctly uses the resources key, ensuring that generated manifests reflect the updated field naming convention.


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

@biswapanda biswapanda enabled auto-merge (squash) May 30, 2025 22:59
@biswapanda biswapanda merged commit 98a5fab into main May 30, 2025
14 checks passed
@biswapanda biswapanda deleted the bis/dep-146-fix-naming-resource branch May 30, 2025 23:06
biswapanda added a commit that referenced this pull request May 31, 2025
biswapanda added a commit that referenced this pull request May 31, 2025
@coderabbitai coderabbitai bot mentioned this pull request May 31, 2025
biswapanda added a commit that referenced this pull request Jun 1, 2025
biswapanda added a commit that referenced this pull request Jun 2, 2025
biswapanda added a commit that referenced this pull request Jun 3, 2025
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