-
Notifications
You must be signed in to change notification settings - Fork 6.7k
[core] Miscellaneous cleanup around storing task outputs #54908
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
Signed-off-by: dayshah <[email protected]>
Signed-off-by: dayshah <[email protected]>
Signed-off-by: dayshah <[email protected]>
Signed-off-by: dayshah <[email protected]>
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.
Summary of Changes
Hello @dayshah, 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 focuses on a series of targeted code cleanups and refactorings within Ray's core components, primarily affecting how task outputs are handled and how worker exit conditions are managed. The changes aim to enhance code readability, improve maintainability, and introduce more robust checks, contributing to a cleaner and more explicit codebase.
Highlights
- Code Clarity & Maintainability: I've inlined the logic for
ShouldExitWorker
directly into theTaskReceiver
to make the worker exit conditions explicit and easier to understand, removing the need for a separate helper method. - Refactoring & Simplification: The
RetryCreate
helper method in the Plasma client has been eliminated by inlining its functionality intoCreateAndSpillIfNeeded
, which reduces indirection and simplifies the object creation retry mechanism. - Robustness: I've added a
RAY_CHECK_OK
assertion in theTaskReceiver
to enforce that the status of task execution isOK
when objects are valid, improving code correctness and making assumptions explicit. - Modern C++ Practices: Various C++ modernizations have been applied, including using
std::move
for efficient resource transfer,std::make_unique
for safer smart pointer creation,std::map::contains
for clearer map lookups, and explicitnullptr
checks for improved code safety and readability. - Cython Workaround Removal: A specific workaround in the Cython
_raylet.pyx
file related to reference assignment has been removed, simplifying the code whereray_error_to_memory_buf
is used.
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 in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command>
or @gemini-code-assist <command>
. Below is a summary of the supported commands.
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 issue 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 or fill out our survey to provide feedback.
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
-
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. ↩
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.
Code Review
This pull request provides a great set of miscellaneous cleanups that improve code quality and clarity. The changes, such as inlining RetryCreate
and ShouldExitWorker
, using modern C++ features like std::move
and nullptr
, and adding defensive checks, are all positive. The code looks good, and I don't have any concerns.
Signed-off-by: dayshah <[email protected]>
Signed-off-by: dayshah <[email protected]>
Signed-off-by: dayshah <[email protected]>
9c0dde7
to
e202cc0
Compare
Signed-off-by: dayshah <[email protected]>
@@ -490,6 +490,7 @@ service NodeManagerService { | |||
returns (RegisterMutableObjectReply); | |||
// Failure: TODO: Handle network failure for cgraphs. | |||
rpc PushMutableObject(PushMutableObjectRequest) returns (PushMutableObjectReply); | |||
// Failure: Uses retryable grpc client for retries. | |||
// Failure: Is currently only used when grpc channel is unavailable for retryable core | |||
// worker clients. The unavailable callback will eventually be retried so if this fails. |
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.
This is unrelated, but just updating to be correct.
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.
Nice cleanup!
} else { | ||
RAY_LOG(FATAL) << "GPU library is not enabled."; | ||
} | ||
physical_buf = wrap_buffer(object_ids[i], physical_buf); |
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.
This line is no longer needed?
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.
ya wrap_buffer was just creating the PlasmaBuffer, before it was like 3 separate statements
- declare Buffer
- Create SharedMemoryBuffer
- Create PlasmaBuffer from SharedMemoryBuffer
all just one statement now
Signed-off-by: dayshah <[email protected]>
updated all the ray_check's in client.cc to use the comparator checks if possible |
Signed-off-by: dayshah <[email protected]>
Signed-off-by: dayshah <[email protected]>
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.
🚢
Why are these changes needed?
Just some cleaning up some code that annoyed me while I was looking through code for #54904. There's no actual functional changes here.
Some of the bigger changes are:
RetryCreate
and deleting itShouldExitWorker
is checking for to make it clearer