Repository navigation
Revert "[Data] Remove safe_round from ExecutionResources hot path (#63680)" - #64296
Conversation
…y-project#63680)" This reverts commit 73f6ede. Signed-off-by: xgui <[email protected]>
There was a problem hiding this comment.
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.
| 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. 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.
| 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 <[email protected]> Signed-off-by: elliot-barn <[email protected]>
…y-project#63680)" (ray-project#64296) Reverts ray-project#63680 for ray-project#64291 . Unblocking the release Signed-off-by: xgui <[email protected]>
…y-project#63680)" (ray-project#64296) Reverts ray-project#63680 for ray-project#64291 . Unblocking the release Signed-off-by: xgui <[email protected]> Signed-off-by: 400Ping <[email protected]>
Reverts #63680 for #64291 .
Unblocking the release