[core] Avoid unnecessary deserialization/serialization of CallerWorkerId#53939
Merged
jjyao merged 2 commits intoray-project:masterfrom Jun 19, 2025
Merged
[core] Avoid unnecessary deserialization/serialization of CallerWorkerId#53939jjyao merged 2 commits intoray-project:masterfrom
jjyao merged 2 commits intoray-project:masterfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR introduces the CallerWorkerIdBinary() API to avoid unnecessary deserialization/serialization when obtaining the caller's worker ID.
- Replaces calls to CallerWorkerId().Binary() with CallerWorkerIdBinary() in task cancellation code.
- Adds a declaration and implementation for CallerWorkerIdBinary() in TaskSpecification to directly return the binary worker ID.
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/ray/core_worker/transport/normal_task_submitter.cc | Updated to use CallerWorkerIdBinary() for cancelling tasks. |
| src/ray/core_worker/transport/actor_task_submitter.cc | Updated to use CallerWorkerIdBinary() for cancelling tasks. |
| src/ray/common/task/task_spec.h | Declares the new CallerWorkerIdBinary() method with inline docs. |
| src/ray/common/task/task_spec.cc | Implements CallerWorkerIdBinary() to return the raw worker ID. |
Comments suppressed due to low confidence (1)
src/ray/common/task/task_spec.h:491
- Ensure that unit tests are updated to verify that CallerWorkerIdBinary() correctly returns the expected binary worker ID and that behavior remains consistent with the previous implementation.
std::string CallerWorkerIdBinary() const;
kevin85421
approved these changes
Jun 19, 2025
Member
|
I have added |
Member
Author
|
cc @jjyao |
israbbani
reviewed
Jun 19, 2025
jjyao
approved these changes
Jun 19, 2025
minerharry
pushed a commit
to minerharry/ray
that referenced
this pull request
Jun 27, 2025
elliot-barn
pushed a commit
that referenced
this pull request
Jul 2, 2025
…rId (#53939) 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?
task_spec.CallerWorkerId().Binary()has unnecessary deserialization/serialization.To be more specific,
CallerWorkerId()converts the worker ID from a binary string to theWorkerID, and.Binary()then converts it back to a binary string, which is unnecessary.To avoid this,
CallerWorkerIdBinaryis added, which could return the binary string directly.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.