[data] revert "continue grabbing task state until response is not None"#61066
Conversation
revert ray-project#60592, cherrypick ray-project#61064 Signed-off-by: Lonnie Liu <lonnie@anyscale.com>
There was a problem hiding this comment.
Code Review
This pull request reverts a previous change regarding hanging task detection logic. The logic to fetch a task's state is now performed eagerly when a task is first suspected of hanging, rather than lazily when an issue is about to be reported. This is a good change as it increases the likelihood of capturing the task state before it might be cleaned up. The associated cleanups, such as removing the task_id from HangingExecutionState and the now-unused get_latest_state_for_task function, are also appropriate.
I've found one minor issue with a type hint that should be corrected for better code quality and correctness.
| task_state: Union[ | ||
| TaskState, List[TaskState] | ||
| ] = ray.util.state.get_task( |
There was a problem hiding this comment.
The type hint for task_state is Union[TaskState, List[TaskState]], but ray.util.state.get_task can also return None. The type hint should be updated to Optional[Union[TaskState, List[TaskState]]] to accurately reflect the possible return values. This will improve code clarity and help static analysis tools.
| task_state: Union[ | |
| TaskState, List[TaskState] | |
| ] = ray.util.state.get_task( | |
| task_state: Optional[Union[ | |
| TaskState, List[TaskState] | |
| ]] = ray.util.state.get_task( |
revert #60592, cherrypick #61064