-
Notifications
You must be signed in to change notification settings - Fork 25.6k
[ML] Return 429 status when RequestExecutorService queue full #134178
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
[ML] Return 429 status when RequestExecutorService queue full #134178
Conversation
Instead of returning a 500 (internal server error) response when the RequestExecutorService queue is full and a new request is submitted, return a 429 (too many requests) response. - Wrap the existing EsRejectedExecutionException in an ElasticsearchStatusException before throwing - Update existing tests for new behaviour
|
Pinging @elastic/ml-core (Team:ML) |
|
Elasticsearch has code in the REST layer that catches any exception and generates a suitable status code for the exception
Drilling into
Any I hardcoded And that takes us to Line 27 in 4dcc81f
|
It looks like we have quite a few unit tests that are explicitly testing the behaviour of the |
This reverts commit 05a2fe0.
Rather than always throwing an ElasticsearchStatusException with 500 status in ActionUtils.wrapFailuresInElasticsearchException(), determine the appropriate status from the unwrapped exception - Remove createInternalServerError() method from ActionUtils - Refactor AlibabaCloudSearch*Action classes to be consistent with SenderExecutableAction - Update tests to account for new behaviour
|
Hi @DonalEvans, I've created a changelog YAML for you. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
I left a suggestion for some code cleanup with the Alibaba action classes. Please can you do that either as part of this PR or in another PR
| // Determine the appropriate RestStatus from the unwrapped exception, then wrap in an ElasticsearchStatusException | ||
| new ElasticsearchStatusException( | ||
| Strings.format("%s. Cause: %s", errorMessage, unwrappedException.getMessage()), | ||
| ExceptionsHelper.status(unwrappedException), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 that's a neat solution
| return; | ||
| } | ||
|
|
||
| ActionListener<InferenceServiceResults> wrappedListener = wrapFailuresInElasticsearchException( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These Alibaba classes are the outlier everything else is done by SenderExecutableAction. Please can you convert AlibabaCloudSearchActionCreator to produce SenderExecutableAction and remove these classes. You will probably have to keep AlibabaCloudSearchCompletionAction as that has extra logic in it to check the inputs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll fix this in another PR, since it's pretty far out of scope for this one.
…c#134178) Rather than always throwing an ElasticsearchStatusException with 500 status in ActionUtils.wrapFailuresInElasticsearchException(), determine the appropriate status from the unwrapped exception - Remove createInternalServerError() method from ActionUtils - Refactor AlibabaCloudSearch*Action classes to be consistent with SenderExecutableAction - Update tests to account for new behaviour
Rather than always throwing an ElasticsearchStatusException with 500 status in ActionUtils.wrapFailuresInElasticsearchException(), determine the appropriate status from the unwrapped exception