Skip to content

Revert "[Data] Remove safe_round from ExecutionResources hot path (#6…#64309

Merged
elliot-barn merged 1 commit into
releases/2.56.0from
elliot-barn-cherry-pick-8178e12
Jun 24, 2026
Merged

Revert "[Data] Remove safe_round from ExecutionResources hot path (#6…#64309
elliot-barn merged 1 commit into
releases/2.56.0from
elliot-barn-cherry-pick-8178e12

Conversation

@elliot-barn

Copy link
Copy Markdown
Collaborator

Cherry pick 8178e12

@elliot-barn elliot-barn requested a review from a team as a code owner June 24, 2026 17:45

@gemini-code-assist gemini-code-assist Bot 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.

Code Review

This pull request simplifies resource quantization in ExecutionResources by rounding resource values directly in __init__ instead of using a lazy quantization cache (_quantized_key). This change removes the singleton caching for zero/infinite resources, simplifies comparison and hash methods, and updates associated tests to align with the new rounding behavior. Feedback on the changes points out that the updated __eq__ method lacks a type check for the other parameter, which could raise an AttributeError when comparing with other types, and suggests adding an isinstance check.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment on lines +107 to +113
def __eq__(self, other: "ExecutionResources") -> bool:
return (
self.cpu == other.cpu
and self.gpu == other.gpu
and self.object_store_memory == other.object_store_memory
and self.memory == other.memory
)

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.

high

The __eq__ method does not check if other is an instance of ExecutionResources before accessing its attributes (e.g., other.cpu). If other is None or an object of another type, this will raise an AttributeError. It is standard practice in Python to check the type of other and return NotImplemented if it is not of the expected type.

Suggested change
def __eq__(self, other: "ExecutionResources") -> bool:
return (
self.cpu == other.cpu
and self.gpu == other.gpu
and self.object_store_memory == other.object_store_memory
and self.memory == other.memory
)
def __eq__(self, other: object) -> bool:
if not isinstance(other, ExecutionResources):
return NotImplemented
return (
self.cpu == other.cpu
and self.gpu == other.gpu
and self.object_store_memory == other.object_store_memory
and self.memory == other.memory
)
…3680)" (#64296)

Reverts #63680 for #64291 .

Unblocking the release

Signed-off-by: xgui <xgui@anyscale.com>
Signed-off-by: elliot-barn <elliot.barnwell@anyscale.com>
@elliot-barn elliot-barn force-pushed the elliot-barn-cherry-pick-8178e12 branch from 54bfadf to 1f1a0dd Compare June 24, 2026 18:07
@elliot-barn elliot-barn merged commit 637fd06 into releases/2.56.0 Jun 24, 2026
5 of 6 checks passed
@elliot-barn elliot-barn deleted the elliot-barn-cherry-pick-8178e12 branch June 24, 2026 18:24
elliot-barn pushed a commit that referenced this pull request Jun 25, 2026
…dge cases (#64354)

## Description

The `get_contributors` release-notes script extracts PR numbers from
commit subjects to look up contributor logins. The old `_find_pr_number`
helper grabbed all text between `(#` and the first `)`, which produced
wrong results for several real commit titles:

- A truncated revert like `Revert "... hot path (#6... (#64309)` yielded
`6... (#64309` instead of `64309`.
- A title carrying a fixed-issue reference followed by the merging PR,
e.g. `... cpu_percent (#63729) (#63733)`, yielded the issue number
`63729` instead of the PR `63733`.
- **Cherry-picks** such as `... in MiB (#63932) (#64042)` (original PR +
backport PR) credited only one number, silently dropping the original
author.

This PR replaces it with `_find_pr_numbers`, which:

- Matches only well-formed `(#<digits>)` tokens using a module-level
compiled regex (the helper runs up to thousands of times per
invocation).
- Returns **every** candidate in title order. The commit text alone
cannot tell an issue from a PR or an original from a backport, so `run`
queries all candidates via the GitHub API and credits each one that
resolves as a real PR. A cherry-pick now credits both the original
author and the backporter.
- Treats a `404` as expected (the number is an issue, not a PR) and
collects those numbers, printing them at the end. This way, if GitHub's
behavior ever changes and a real PR starts returning `404`, the dropped
numbers are surfaced rather than silently lost.

## Related issues

N/A

## Additional information

Unit tests cover the parsing edge cases (truncated revert, issue+PR,
cherry-pick, non-digit parentheticals) and the CLI behavior (both
cherry-pick authors credited; an issue `404` does not drop the real PR
author and is reported in the output).

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Signed-off-by: sai.miduthuri <sai.miduthuri@anyscale.com>
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
limarkdcunha pushed a commit to limarkdcunha/ray that referenced this pull request Jun 30, 2026
…dge cases (ray-project#64354)

## Description

The `get_contributors` release-notes script extracts PR numbers from
commit subjects to look up contributor logins. The old `_find_pr_number`
helper grabbed all text between `(#` and the first `)`, which produced
wrong results for several real commit titles:

- A truncated revert like `Revert "... hot path (ray-project#6... (ray-project#64309)` yielded
`6... (ray-project#64309` instead of `64309`.
- A title carrying a fixed-issue reference followed by the merging PR,
e.g. `... cpu_percent (ray-project#63729) (ray-project#63733)`, yielded the issue number
`63729` instead of the PR `63733`.
- **Cherry-picks** such as `... in MiB (ray-project#63932) (ray-project#64042)` (original PR +
backport PR) credited only one number, silently dropping the original
author.

This PR replaces it with `_find_pr_numbers`, which:

- Matches only well-formed `(#<digits>)` tokens using a module-level
compiled regex (the helper runs up to thousands of times per
invocation).
- Returns **every** candidate in title order. The commit text alone
cannot tell an issue from a PR or an original from a backport, so `run`
queries all candidates via the GitHub API and credits each one that
resolves as a real PR. A cherry-pick now credits both the original
author and the backporter.
- Treats a `404` as expected (the number is an issue, not a PR) and
collects those numbers, printing them at the end. This way, if GitHub's
behavior ever changes and a real PR starts returning `404`, the dropped
numbers are surfaced rather than silently lost.

## Related issues

N/A

## Additional information

Unit tests cover the parsing edge cases (truncated revert, issue+PR,
cherry-pick, non-digit parentheticals) and the CLI behavior (both
cherry-pick authors credited; an issue `404` does not drop the real PR
author and is reported in the output).

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Signed-off-by: sai.miduthuri <sai.miduthuri@anyscale.com>
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants