Skip to content

Conversation

@davidkyle
Copy link
Member

Consistently using exceptions for errors instead of WarningInferenceResults. Using a mixture of the 2 complicates debugging and triaging as more both warnings and exceptions have to be checked.

Many of the uses of WarningInferenceResults related to validating the output of the native pytorch process. Those unexpected results are more accurately internal server errors not a warning.

Backport of #81735

Consistently using exceptions for errors instead of WarningInferenceResults
to simplify debugging/triaging
# Conflicts:
#	x-pack/plugin/ml/qa/native-multi-node-tests/src/javaRestTest/java/org/elasticsearch/xpack/ml/integration/PyTorchModelIT.java
#	x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/inference/nlp/FillMaskProcessor.java
#	x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/inference/nlp/NerProcessor.java
#	x-pack/plugin/ml/src/test/java/org/elasticsearch/xpack/ml/inference/nlp/FillMaskProcessorTests.java
#	x-pack/plugin/ml/src/test/java/org/elasticsearch/xpack/ml/inference/nlp/NerProcessorTests.java
#	x-pack/plugin/ml/src/test/java/org/elasticsearch/xpack/ml/inference/nlp/TextClassificationProcessorTests.java
@davidkyle davidkyle added :ml Machine learning backport v8.0.0 auto-merge-without-approval Automatically merge pull request when CI checks pass (NB doesn't wait for reviews!) labels Dec 15, 2021
@elasticmachine elasticmachine added the Team:ML Meta label for the ML team label Dec 15, 2021
@elasticmachine
Copy link
Collaborator

Pinging @elastic/ml-core (Team:ML)

) {
if (tokenization.getTokenizations().isEmpty() || tokenization.getTokenizations().get(0).getTokens().length == 0) {
return new WarningInferenceResults("No valid tokens for inference");
throw new ElasticsearchStatusException("tokenization is empty", RestStatus.INTERNAL_SERVER_ERROR);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't this a bad request exception? If yes, we should reuse ExceptionsHelpers.badRequestException. Same stands for all the other exceptions in the PR that are marked as internal server error.

Copy link
Member Author

@davidkyle davidkyle Dec 15, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The tokenisation is checked before the request is sent, for fill mask the error will be about a missing mask token. Here at results processing, if the tokenisation is not present something has gone badly wrong as we do not send the request if the tokenisation is not present.

@elasticsearchmachine elasticsearchmachine merged commit f613df6 into elastic:8.0 Dec 15, 2021
@davidkyle davidkyle deleted the warnings-bp branch December 15, 2021 15:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

auto-merge-without-approval Automatically merge pull request when CI checks pass (NB doesn't wait for reviews!) backport :ml Machine learning Team:ML Meta label for the ML team v8.0.0-rc1

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants