Skip to content

Revert "[Data] Remove safe_round from ExecutionResources hot path (#63680)" - #64296

Merged
richardliaw merged 1 commit into
ray-project:masterfrom
xinyuangui2:revert-63680
Jun 24, 2026
Merged

richardliaw merged 1 commit into
ray-project:masterfrom
xinyuangui2:revert-63680

Conversation

@xinyuangui2

@xinyuangui2 xinyuangui2 commented Jun 24, 2026 •

Copy link
Copy Markdown
Contributor

Reverts #63680 for #64291 .

Unblocking the release

@xinyuangui2
xinyuangui2 requested a review from a team as a code owner June 24, 2026 01:33

@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 the ExecutionResources class by performing resource quantization (rounding) directly during initialization rather than lazily on access. This change allows for the removal of cached singletons, immutability checks, and complex quantization logic across comparison methods. The review feedback correctly identifies that the updated __eq__ method lacks an isinstance check for the other argument, which could lead to an AttributeError when comparing ExecutionResources with other types or None, and provides a code suggestion to resolve this.

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 +112 to +118
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. This will raise an AttributeError if the object is compared to None or an object of a different type. It is standard Python practice to handle this by checking isinstance and returning NotImplemented if the types do not match.

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
)

@ray-gardener ray-gardener Bot added the data Ray Data-related issues label Jun 24, 2026
@xinyuangui2 xinyuangui2 added the go add ONLY when ready to merge, run all tests label Jun 24, 2026
@richardliaw
richardliaw merged commit 8178e12 into ray-project:master Jun 24, 2026
4 checks passed
elliot-barn pushed a commit that referenced this pull request Jun 24, 2026
…3680)" (#64296)

Reverts #63680 for #64291 .

Unblocking the release

Signed-off-by: xgui <[email protected]>
Signed-off-by: elliot-barn <[email protected]>
limarkdcunha pushed a commit to limarkdcunha/ray that referenced this pull request Jun 30, 2026
400Ping pushed a commit to 400Ping/ray that referenced this pull request Aug 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

data Ray Data-related issues go add ONLY when ready to merge, run all tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants