[core][3/N] Avoid unnecessary deserialization/serialization of ParentTaskId#53695
Merged
edoakes merged 1 commit intoray-project:masterfrom Jun 10, 2025
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR introduces a new ParentTaskIdBinary() method to avoid extra serialization/deserialization of the parent task ID and updates usage sites accordingly.
- Added
ParentTaskIdBinary()to return the raw binary ID without wrapping - Replaced
ParentTaskId().Binary()calls in stats gathering withParentTaskIdBinary() - Handled empty parent ID explicitly to return a nil ID binary
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/ray/core_worker/task_manager.cc | Swapped ParentTaskId().Binary() for ParentTaskIdBinary() |
| src/ray/common/task/task_spec.h | Declared new ParentTaskIdBinary() API |
| src/ray/common/task/task_spec.cc | Implemented ParentTaskIdBinary(), handling empty ID as nil |
Comments suppressed due to low confidence (2)
src/ray/common/task/task_spec.h:304
- [nitpick] Consider using a Doxygen-style comment (/** ... */) and clarifying that this returns the raw serialized ID, returning the nil representation when unset.
// Get the parent task id in binary format.
src/ray/common/task/task_spec.cc:180
- There are no unit tests covering the new
ParentTaskIdBinary()behavior; consider adding tests for both empty (nil) and non-empty parent IDs to prevent regressions.
if (message_->parent_task_id().empty()) {
edoakes
approved these changes
Jun 10, 2025
elliot-barn
pushed a commit
that referenced
this pull request
Jun 18, 2025
…TaskId (#53695) ```cpp task_spec.ParentTaskId().Binary() ``` * `ParentTaskId()` deserializes binary to `TaskId`. * `Binary()` serializes `TaskId` to binary. Signed-off-by: Kai-Hsun Chen <kaihsun@anyscale.com> Signed-off-by: elliot-barn <elliot.barnwell@anyscale.com>
elliot-barn
pushed a commit
that referenced
this pull request
Jul 2, 2025
…TaskId (#53695) ```cpp task_spec.ParentTaskId().Binary() ``` * `ParentTaskId()` deserializes binary to `TaskId`. * `Binary()` serializes `TaskId` to binary. Signed-off-by: Kai-Hsun Chen <kaihsun@anyscale.com> Signed-off-by: elliot-barn <elliot.barnwell@anyscale.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why are these changes needed?
ParentTaskId()deserializes binary toTaskId.Binary()serializesTaskIdto binary.Related issue number
Checks
git commit -s) in this PR.scripts/format.shto lint the changes in this PR.method in Tune, I've added it in
doc/source/tune/api/under thecorresponding
.rstfile.