Skip to content

Conversation

@JasonZhang517
Copy link
Contributor

Corresponding to #978
Based on existing create method:
store.setup(
local_hostname="host1",
metadata_server="127.0.0.1:8080",
global_segment_size=1024102416,
local_buffer_size=1024102416,
protocol="tcp",
rdma_devices="",
master_server_addr="127.0.0.1:50051",
engine=None
)
Added builder functions in store_py.cpp

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @JasonZhang517, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request refactors the initialization process for the MooncakeDistributedStore client by implementing a builder pattern. This change provides a more structured, readable, and flexible way to configure the store, replacing the previous setup() method with a fluent API that allows parameters to be set via chained method calls. The builder pattern is implemented in C++ and exposed to Python, enhancing the user experience for both language environments.

Highlights

  • New Builder Pattern: Introduced a builder pattern for MooncakeDistributedStore initialization in both C++ and Python, providing a more structured and readable configuration approach.
  • Deprecation of setup() method: The existing setup() method in PyClient has been marked as deprecated, encouraging users to transition to the new builder pattern for store configuration.
  • Python Bindings: Implemented pybind11 bindings for the C++ builder, enabling a fluent API for Python users to configure the Mooncake store.
  • New Test File: Added a new Python test file (test_py_store_builder.py) to thoroughly validate the builder's functionality across various parameter configurations, including minimal and zero-sized settings.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a builder pattern for creating MooncakeDistributedStore instances from Python, which is a great improvement for API usability. The implementation is well-structured, adding both a C++ builder (MooncakeStoreBuilder) and a pybind11 wrapper (MooncakeStoreBuilderPy), along with corresponding tests. I have identified a critical bug in the C++ builder's error reporting, some dead code in the pybind wrapper, and a minor portability concern in the new tests. Addressing these points will enhance the code's correctness and maintainability.

Comment on lines 181 to 193
MooncakeStoreBuilder builder;
builder.WithLocalHostname(this->local_hostname)
.WithMetadataConnectionString(metadata_server)
.UsingProtocol(protocol)
.WithMasterServerEntry(master_server_addr);

if (device_name) {
builder.WithRdmaDeviceNames(*device_name);
}
if (transfer_engine) {
builder.WithExistingTransferEngine(transfer_engine);
}

Copy link
Contributor

Choose a reason for hiding this comment

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

high

This block of code creates and configures a MooncakeStoreBuilder instance named builder, but this variable is never used. The actual client is created using a separate temporary builder instance on line 194. This unused code block is confusing and should be removed.

Comment on lines +13 to +14
os.environ["LD_LIBRARY_PATH"] = \
"/usr/lib/x86_64-linux-gnu:" + os.environ.get("LD_LIBRARY_PATH", "")
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

Hardcoding the path /usr/lib/x86_64-linux-gnu for LD_LIBRARY_PATH may reduce the portability of this test, as this path is specific to Debian-based distributions like Ubuntu. Consider making this more robust, for example by searching for libstdc++.so.6 in common system library directories, or at least adding a comment to explain why this specific path is needed for the test environment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants