-
Notifications
You must be signed in to change notification settings - Fork 6.8k
[core][refactor] replace unnecessary shared_ptrs with unique_ptrs and references in raylet #54062
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
f48c876
to
8d3ce74
Compare
… references in raylet Signed-off-by: Rueian <rueian@anyscale.com> Signed-off-by: Rueian <rueiancsie@gmail.com>
8d3ce74
to
2ffa8f9
Compare
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.
Pull Request Overview
This PR replaces unnecessary std::shared_ptr
usages with std::unique_ptr
and raw references in the Raylet code to improve ownership clarity and reduce overhead.
- Changed constructors and member fields to accept and store non-owning references for
gcs::GcsClient
and other interfaces. - Updated all call sites in tests,
main.cc
, and various Raylet modules to pass dereferenced pointers. - Adjusted the BUILD file to include the new
:ray_mock
target and consolidatecompiler_param_file
features.
Reviewed Changes
Copilot reviewed 19 out of 19 changed files in this pull request and generated 1 comment.
Show a summary per file
File | Description |
---|---|
src/ray/raylet/worker_pool.h | Changed gcs_client from shared_ptr to reference |
src/ray/raylet/worker_pool.cc | Updated initializer list and calls to use reference |
src/ray/raylet/worker_pool_test.cc | Passed *mock_gcs_client_ into test constructor |
src/ray/raylet/node_manager.h | Refactored numerous params and members to references |
src/ray/raylet/node_manager.cc | Updated method bodies to use reference members |
src/ray/raylet/raylet.h | Switched gcs_client and node_manager to references |
src/ray/raylet/raylet.cc | Updated ctor and member access to reference style |
src/ray/raylet/placement_group_resource_manager.{h,cc} | Changed scheduler member to reference |
src/ray/raylet/main.cc | Switched shared_ptr to unique_ptr and passed references |
src/ray/object_manager/ownership_object_directory.{h,cc} | Converted gcs_client fields and calls to reference |
src/ray/object_manager/object_manager.{h,cc} | Updated gcs_client ownership to reference |
BUILD.bazel | Added :ray_mock and consolidated compiler_param_file features |
Comments suppressed due to low confidence (2)
src/ray/raylet/worker_pool.h:324
- [nitpick] The constructor parameter
gcs_client
is now a non-owning reference; consider updating the doc comment to note that the caller must guarantee its lifetime outlives theWorkerPool
instance.
gcs::GcsClient &gcs_client,
src/ray/raylet/node_manager.h:138
- [nitpick] Update the parameter comment for
gcs_client
to clarify that this is a non-owning reference and must remain valid for the lifetime ofNodeManager
.
gcs::GcsClient &gcs_client,
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.
thanks a lot for doing this!!! @edoakes for merge
amazing, thanks @rueian |
… references in raylet (ray-project#54062) Following the suggestion in ray-project#53782 (comment), this PR replace all unnecessary shared_ptrs with unique_ptrs and references in Raylet. Signed-off-by: Rueian <rueian@anyscale.com> Signed-off-by: Rueian <rueiancsie@gmail.com>
… references in raylet (#54062) Following the suggestion in #53782 (comment), this PR replace all unnecessary shared_ptrs with unique_ptrs and references in Raylet. Signed-off-by: Rueian <rueian@anyscale.com> Signed-off-by: Rueian <rueiancsie@gmail.com> Signed-off-by: elliot-barn <elliot.barnwell@anyscale.com>
Why are these changes needed?
Following the suggestion in #53782 (comment), this PR replace all unnecessary shared_ptrs with unique_ptrs and references in Raylet.
Hi @dayshah,
Could you take a look? Thanks!
Checks
git commit -s
) in this PR.scripts/format.sh
to lint the changes in this PR.method in Tune, I've added it in
doc/source/tune/api/
under thecorresponding
.rst
file.