Skip to content

[core][3/N] Avoid unnecessary deserialization/serialization of ParentTaskId - #53695

Merged
edoakes merged 1 commit into
ray-project:masterfrom
kevin85421:laptop-ray2-20250610
Jun 10, 2025
Merged

edoakes merged 1 commit into
ray-project:masterfrom
kevin85421:laptop-ray2-20250610

Conversation

@kevin85421

@kevin85421 kevin85421 commented Jun 10, 2025 •

Copy link
Copy Markdown
Member

Why are these changes needed?

task_spec.ParentTaskId().Binary()
  • ParentTaskId() deserializes binary to TaskId.
  • Binary() serializes TaskId to binary.

Related issue number

Checks

Signed-off-by: Kai-Hsun Chen <[email protected]>
@kevin85421 kevin85421 added the go add ONLY when ready to merge, run all tests label Jun 10, 2025
@kevin85421
kevin85421 marked this pull request as ready for review June 10, 2025 16:29
Copilot AI review requested due to automatic review settings June 10, 2025 16:29

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 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 with ParentTaskIdBinary()
  • 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()) {

Comment thread src/ray/common/task/task_spec.cc Resolved
@edoakes
edoakes merged commit a6c5ecf into ray-project:master 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 <[email protected]>
Signed-off-by: elliot-barn <[email protected]>
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 <[email protected]>
Signed-off-by: elliot-barn <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

go add ONLY when ready to merge, run all tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants