This repository has been archived by the owner on Apr 26, 2024. It is now read-only.
Fix RayTaskRunner
exception handling in Prefect >= 2.6.0
#60
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In Prefect 2.6.0,
exception_to_crashed_state
changed from a sync function to an async function that needs to be awaited.RayTaskRunner
does not currently await this call, resulting in users seeingcoroutine' object has no attribute 'type'
when an unhandled exception occurs while a Ray worker node is trying to unpickle and load the task.Consequently, it is difficult to see and understand what went wrong. Looking at logs from the Ray worker node(s) that tried to execute the failed task(s) will usually show what went wrong, but not all users who can submit work to a Ray cluster will have access to individual worker node logs.
Several users have encountered this issue, as noted in this Discourse post and issue #58.
Changes in this PR:
RayTaskError
exception_to_crashed_state
so users will see the actual exception instead ofcoroutine' object has no attribute 'result'
Closes #58
Example
Start by reproducing the error:
pip install prefect "ray[default]"
ray start --head
AttributeError: 'coroutine' object has no attribute 'result'
error instead of the error you raisedray.exceptions.TaskCancelledError: Task: TaskID(...) was cancelled
Checklist