Revert "[Data] Remove safe_round from ExecutionResources hot path (#6…#64309
Conversation
There was a problem hiding this comment.
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.
| 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 | ||
| ) |
There was a problem hiding this comment.
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.
| 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 | |
| ) |
54bfadf to
1f1a0dd
Compare
…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>
…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>
Cherry pick 8178e12