-
Notifications
You must be signed in to change notification settings - Fork 690
docs: hello_world python binding example #2083
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
WalkthroughThis change adds a new example under Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant Runtime
participant Backend
Client->>Runtime: Register worker
Runtime->>Backend: Start service with endpoint
Client->>Backend: Send request (comma-separated words)
loop For each word
Backend-->>Client: Stream greeting ("Hello, <word>!")
end
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Poem
Note ⚡️ Unit Test Generation - BetaCodeRabbit's unit test generation is now available in Beta! Automatically generate comprehensive unit tests for your code changes, ensuring better test coverage and catching edge cases you might miss. Our AI analyzes your code structure and creates tests that follow best practices and your project's testing patterns. Learn more here, or just try it under ✨ Finishing Touches. 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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed 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)
Other keywords and placeholders
Documentation and Community
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🧹 Nitpick comments (3)
examples/runtime/hello_world/README.md (3)
24-31: Add language specification to code block.The ASCII art diagram should specify a language for proper rendering.
-``` +```text Client (dynamo_worker) │ ▼ ┌─────────────┐ │ Backend │ Dynamo endpoint (/generate) └─────────────┘ -``` +```
55-56: Fix unordered list indentation.The list items should not be indented as they are top-level items.
- - **etcd**: A distributed key-value store used for service discovery and metadata storage - - **NATS**: A high-performance message broker for inter-component communication +- **etcd**: A distributed key-value store used for service discovery and metadata storage +- **NATS**: A high-performance message broker for inter-component communication
86-91: Add language specification to output example.The expected output code block should specify the language for better rendering.
-``` +```text Hello world! Hello sun! Hello moon! Hello star! -``` +```
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
examples/runtime/hello_world/README.md(1 hunks)examples/runtime/hello_world/client.py(1 hunks)examples/runtime/hello_world/hello_world.py(1 hunks)
🧰 Additional context used
🧠 Learnings (3)
examples/runtime/hello_world/client.py (1)
Learnt from: nnshah1
PR: #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.
examples/runtime/hello_world/README.md (1)
Learnt from: nnshah1
PR: #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.
examples/runtime/hello_world/hello_world.py (1)
Learnt from: nnshah1
PR: #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.
🪛 LanguageTool
examples/runtime/hello_world/README.md
[style] ~36-~36: Consider using “who” when you are referring to a person instead of an object.
Context: ...ated word - Client: A Dynamo worker that connects to and sends requests to the b...
(THAT_WHO)
[style] ~98-~98: Consider using “who” when you are referring to a person instead of an object.
Context: ...eetings - worker: A dynamo worker that sets up the service, creates the endpoi...
(THAT_WHO)
[style] ~102-~102: Consider using “who” when you are referring to a person instead of an object.
Context: ...t.py) - **worker`**: A dynamo worker that connects to the backend service and pro...
(THAT_WHO)
🪛 markdownlint-cli2 (0.17.2)
examples/runtime/hello_world/README.md
24-24: Fenced code blocks should have a language specified
(MD040, fenced-code-language)
55-55: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
56-56: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
86-86: Fenced code blocks should have a language specified
(MD040, fenced-code-language)
🔇 Additional comments (5)
examples/runtime/hello_world/hello_world.py (2)
37-53: LGTM! Proper implementation of Dynamo worker pattern.The worker function correctly demonstrates the Dynamo distributed runtime patterns:
- Creates namespace and component structure
- Properly initializes the service
- Serves the endpoint with the streaming function
- Good logging for debugging
55-57: LGTM! Proper async main entry point.Good use of uvloop for performance optimization and proper async execution of the worker.
examples/runtime/hello_world/client.py (2)
23-38: LGTM! Clean client implementation demonstrating proper Dynamo patterns.The client code properly demonstrates:
- Correct use of
@dynamo_worker()decorator- Proper service endpoint resolution
- Client creation and readiness waiting
- Async streaming consumption
The implementation is clean and follows Dynamo best practices.
40-42: LGTM! Consistent async setup with backend.Proper use of uvloop and async execution pattern matching the backend service.
examples/runtime/hello_world/README.md (1)
18-103: LGTM! Comprehensive and well-structured documentation.The README provides excellent documentation covering:
- Clear architecture explanation
- Detailed component descriptions
- Prerequisites and setup instructions
- Running instructions with expected output
- Code structure breakdown
The documentation effectively guides users through understanding and running the example.
whoisj
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like it. Simple. Thanks!
Summary by CodeRabbit