-
Notifications
You must be signed in to change notification settings - Fork 25.2k
Include reason in TaskCancelledException #74825
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Pinging @elastic/es-distributed (Team:Distributed) |
As things stand today, the task framework only creates a
I think including the reason makes sense here, although in fact There's a broader question about whether we should leave it up to callers to check for cancellation and construct their own |
Today when a task is cancelled we record the reason for the cancellation but this information is very rarely exposed to users. This commit centralises the construction of the `TaskCancellationException` and includes the reason in the exception message. Closes elastic#74825
Today when a task is cancelled we record the reason for the cancellation but this information is very rarely exposed to users. This commit centralises the construction of the `TaskCancellationException` and includes the reason in the exception message. Closes #74825
Today when a task is cancelled we record the reason for the cancellation but this information is very rarely exposed to users. This commit centralises the construction of the `TaskCancellationException` and includes the reason in the exception message. Closes #74825
Today when a task is cancelled we record the reason for the cancellation but this information is very rarely exposed to users. This commit centralises the construction of the `TaskCancellationException` and includes the reason in the exception message. Closes elastic#74825
The task framework allows cancelling a task. The cancel task request also accepts a
reason
. However, that reason is not a part of theTaskCancelledException
. Incorporating the reason into theTaskCancelledException
would improve the information a user receives when their request fails because the corresponding task was cancelled.There is a number of places where
TaskCancelledException
is thrown. For example, here it is thrown because a child task is tried to be started but the parent has been cancelled. The user will see"The parent task was cancelled, shouldn't start any child tasks"
but not the reason the task has been cancelled, which would be greatly more informative as to what is going on.I will also mention an ML use case to highlight the benefit of including the reason.
For ML anomaly detection jobs, we have a reset and a delete API. They both result in the deletion of the results and state of the job, which could be a long running task. If a user calls the delete API while a reset task is ongoing, it makes no sense to fail the call. Delete should take precedence. Thus, the delete API checks if there's a reset task running and cancels it with a reason
deleting job
. Then the caller of the reset API receives a response that contains theTaskCancelledException
. However, that does not include the reason so the user does not get the critical piece of information that their reset was cancelled because some other user deleted the job entirely.The text was updated successfully, but these errors were encountered: